From: martin.blumenstingl@googlemail.com (Martin Blumenstingl)
To: linus-amlogic@lists.infradead.org
Subject: [PATCH usb v6 4/6] usb: core: phy: make it a no-op if CONFIG_GENERIC_PHY is disabled
Date: Wed, 18 Apr 2018 21:39:49 +0200 [thread overview]
Message-ID: <20180418193951.17922-5-martin.blumenstingl@googlemail.com> (raw)
In-Reply-To: <20180418193951.17922-1-martin.blumenstingl@googlemail.com>
If the generic PHY support is disabled the stub of devm_of_phy_get_by_index
returns ENOSYS. This corner case isn't handled properly by
usb_phy_roothub_add_phy and at least breaks USB support on Raspberry Pi
(bcm2835_defconfig):
dwc2 20980000.usb: dwc2_hcd_init() FAILED, returning -38
dwc2: probe of 20980000.usb failed with error -38
Let usb_phy_roothub_alloc() return in case CONFIG_GENERIC_PHY is
disabled to fix this issue (compilers might even be smart enough to
optimize away most of the code within usb_phy_roothub_alloc and
usb_phy_roothub_add_phy if CONFIG_GENERIC_PHY is disabled). All
existing usb_phy_roothub_* functions are already NULL-safe, so no
special handling is required there.
Fixes: 07dbff0ddbd8 ("usb: core: add a wrapper for the USB PHYs on the HCD")
Reported-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
drivers/usb/core/phy.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/core/phy.c b/drivers/usb/core/phy.c
index a39d9bb26a4f..9879767452a2 100644
--- a/drivers/usb/core/phy.c
+++ b/drivers/usb/core/phy.c
@@ -50,6 +50,9 @@ struct usb_phy_roothub *usb_phy_roothub_alloc(struct device *dev)
struct usb_phy_roothub *phy_roothub;
int i, num_phys, err;
+ if (!IS_ENABLED(CONFIG_GENERIC_PHY))
+ return NULL;
+
num_phys = of_count_phandle_with_args(dev->of_node, "phys",
"#phy-cells");
if (num_phys <= 0)
--
2.17.0
next prev parent 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 ` [PATCH usb v6 1/6] usb: core: phy: fix return value of usb_phy_roothub_exit() Martin Blumenstingl
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 ` Martin Blumenstingl [this message]
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-5-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®