diff mbox

Usb: core: Correct self assignment in phy.c

Message ID 1523055840-28858-1-git-send-email-rishabhb@codeaurora.org (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Rishabh Bhatnagar April 6, 2018, 11:04 p.m. UTC
In file drivers/usb/core/phy.c line 114, ret variable is assigned to
itself. The following error was observed:

kernel/drivers/usb/core/phy.c:114:8: warning: explicitly assigning value of
variable of type 'int' to itself [-Wself-assign] error, forbidden
warning: phy.c:114
This error was found when compiling with Clang. Change it to ret = err.

Fixes: commit 07dbff0ddbd8 ("usb: core: add a wrapper for the USB PHYs on the HCD")
Signed-off-by: Rishabh Bhatnagar <rishabhb@codeaurora.org>
---
 drivers/usb/core/phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Martin Blumenstingl April 7, 2018, 10:55 a.m. UTC | #1
Hello,

thank you for finding this!

On Sat, Apr 7, 2018 at 1:04 AM, Rishabh Bhatnagar
<rishabhb@codeaurora.org> wrote:
> In file drivers/usb/core/phy.c line 114, ret variable is assigned to
> itself. The following error was observed:
>
> kernel/drivers/usb/core/phy.c:114:8: warning: explicitly assigning value of
> variable of type 'int' to itself [-Wself-assign] error, forbidden
> warning: phy.c:114
> This error was found when compiling with Clang. Change it to ret = err.
I found the same bug myself two weeks ago and already sent a patch: [0]
it has not made it to Greg's tree yet. Greg asked me to re-send that
patch along with some others after -rc1 is out: [1]

> Fixes: commit 07dbff0ddbd8 ("usb: core: add a wrapper for the USB PHYs on the HCD")
> Signed-off-by: Rishabh Bhatnagar <rishabhb@codeaurora.org>
would you like me to add your Acked-by or Signed-off-by to my patch?

> ---
>  drivers/usb/core/phy.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/core/phy.c b/drivers/usb/core/phy.c
> index 09b7c43..f19aaa3 100644
> --- a/drivers/usb/core/phy.c
> +++ b/drivers/usb/core/phy.c
> @@ -111,7 +111,7 @@ int usb_phy_roothub_exit(struct usb_phy_roothub *phy_roothub)
>         list_for_each_entry(roothub_entry, head, list) {
>                 err = phy_exit(roothub_entry->phy);
>                 if (err)
> -                       ret = ret;
> +                       ret = err;
>         }
>
>         return ret;
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>


Regards
Martin


[0] http://lists.infradead.org/pipermail/linux-amlogic/2018-March/006819.html
[1] http://lists.infradead.org/pipermail/linux-amlogic/2018-April/006977.html
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/usb/core/phy.c b/drivers/usb/core/phy.c
index 09b7c43..f19aaa3 100644
--- a/drivers/usb/core/phy.c
+++ b/drivers/usb/core/phy.c
@@ -111,7 +111,7 @@  int usb_phy_roothub_exit(struct usb_phy_roothub *phy_roothub)
 	list_for_each_entry(roothub_entry, head, list) {
 		err = phy_exit(roothub_entry->phy);
 		if (err)
-			ret = ret;
+			ret = err;
 	}
 
 	return ret;