mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
From: martin.blumenstingl@googlemail.com (Martin Blumenstingl)
To: linus-amlogic@lists.infradead.org
Subject: [PATCH usb v6 1/6] usb: core: phy: fix return value of usb_phy_roothub_exit()
Date: Wed, 18 Apr 2018 21:39:46 +0200	[thread overview]
Message-ID: <20180418193951.17922-2-martin.blumenstingl@googlemail.com> (raw)
In-Reply-To: <20180418193951.17922-1-martin.blumenstingl@googlemail.com>

usb_phy_roothub_exit() should return the error code from the phy_exit()
call if exiting the PHY failed.
However, since a wrong variable is used usb_phy_roothub_exit() currently
always returns 0, even if one of the phy_exit calls returned an error.
Clang also reports this bug:
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

Fix this by assigning the error code from phy_exit() to the "ret"
variable to propagate the error correctly.

Fixes: 07dbff0ddbd86c ("usb: core: add a wrapper for the USB PHYs on the HCD")
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Rishabh Bhatnagar <rishabhb@codeaurora.org>
Tested-by: Keerthy <j-keerthy@ti.com>
---
 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 09b7c43c0ea4..f19aaa3c899c 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;
-- 
2.17.0

  reply	other threads:[~2018-04-18 19:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-18 19:39 [PATCH usb v6 0/6] usb/core/phy fixes for v4.17 Martin Blumenstingl
2018-04-18 19:39 ` Martin Blumenstingl [this message]
2018-04-18 19:39 ` [PATCH usb v6 2/6] usb: core: split usb_phy_roothub_{init,alloc} Martin Blumenstingl
2018-04-18 19:39 ` [PATCH usb v6 3/6] usb: core: use phy_exit during suspend if wake up is not supported Martin Blumenstingl
2018-04-18 19:39 ` [PATCH usb v6 4/6] usb: core: phy: make it a no-op if CONFIG_GENERIC_PHY is disabled Martin Blumenstingl
2018-04-18 19:39 ` [PATCH usb v6 5/6] usb: core: phy: add missing forward declaration for "struct device" Martin Blumenstingl
2018-04-18 19:39 ` [PATCH usb v6 6/6] usb: core: phy: add the SPDX-License-Identifier and include guard Martin Blumenstingl
2018-04-22 13:01   ` Greg KH
2018-04-22 19:41     ` Martin Blumenstingl
2018-04-23  7:39       ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180418193951.17922-2-martin.blumenstingl@googlemail.com \
    --to=martin.blumenstingl@googlemail.com \
    --cc=linus-amlogic@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®