aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/usb/phy
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-07-26 11:16:46 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-07-26 11:16:46 +0200
commitd842bc6c0579ca7643eed029beabab3ac562a335 (patch)
tree6e1f1521efe88b095b14a759ea15aa81e7b0e33f /drivers/usb/phy
parentusb: dwc3: dwc3-qcom: Fix typo in the dwc3 vbus override API (diff)
parentLinux 5.14-rc3 (diff)
downloadwireguard-linux-d842bc6c0579ca7643eed029beabab3ac562a335.tar.xz
wireguard-linux-d842bc6c0579ca7643eed029beabab3ac562a335.zip
Merge v5.14-rc3 into usb-next
We need the fixes in here, and this resolves a merge issue with drivers/usb/dwc3/gadget.c Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/phy')
-rw-r--r--drivers/usb/phy/phy.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c
index 83ed5089475a..1b24492bb4e5 100644
--- a/drivers/usb/phy/phy.c
+++ b/drivers/usb/phy/phy.c
@@ -86,10 +86,10 @@ static struct usb_phy *__device_to_usb_phy(struct device *dev)
list_for_each_entry(usb_phy, &phy_list, head) {
if (usb_phy->dev == dev)
- break;
+ return usb_phy;
}
- return usb_phy;
+ return NULL;
}
static void usb_phy_set_default_current(struct usb_phy *usb_phy)
@@ -150,8 +150,14 @@ static int usb_phy_uevent(struct device *dev, struct kobj_uevent_env *env)
struct usb_phy *usb_phy;
char uchger_state[50] = { 0 };
char uchger_type[50] = { 0 };
+ unsigned long flags;
+ spin_lock_irqsave(&phy_lock, flags);
usb_phy = __device_to_usb_phy(dev);
+ spin_unlock_irqrestore(&phy_lock, flags);
+
+ if (!usb_phy)
+ return -ENODEV;
snprintf(uchger_state, ARRAY_SIZE(uchger_state),
"USB_CHARGER_STATE=%s", usb_chger_state[usb_phy->chg_state]);