summaryrefslogtreecommitdiff
path: root/drivers/usb/phy
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-01-12 10:51:04 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-01-12 10:51:04 -0800
commit06087cb42dc1da096c37f51ea12ad676f00569a9 (patch)
tree22408ce4ca111f74fec50994b7d38b89f33dd738 /drivers/usb/phy
parent9c9d82492b73991e8e13a6c0af06e44816c31438 (diff)
parent5fb694f96e7c19e66b1c55124b98812e32e3efa5 (diff)
Merge tag 'fixes-for-v3.19-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus
Felipe writes: usb: fixes for v3.19-rc5 Just three fixes this time. An oops fix in ep_write() from gadgetfs, another oops for the Atmel UDC when unloading a gadget driver and the fix for PHY deferred probing. Signed-off-by: Felipe Balbi <balbi@ti.com> Conflicts: drivers/usb/phy/phy.c
Diffstat (limited to 'drivers/usb/phy')
-rw-r--r--drivers/usb/phy/phy.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c
index 353c686498d4..ccfdfb24b240 100644
--- a/drivers/usb/phy/phy.c
+++ b/drivers/usb/phy/phy.c
@@ -59,6 +59,9 @@ static struct usb_phy *__of_usb_find_phy(struct device_node *node)
{
struct usb_phy *phy;
+ if (!of_device_is_available(node))
+ return ERR_PTR(-ENODEV);
+
list_for_each_entry(phy, &phy_list, head) {
if (node != phy->dev->of_node)
continue;
@@ -190,10 +193,13 @@ struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev,
spin_lock_irqsave(&phy_lock, flags);
phy = __of_usb_find_phy(node);
- if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) {
- if (!IS_ERR(phy))
- phy = ERR_PTR(-ENODEV);
+ if (IS_ERR(phy)) {
+ devres_free(ptr);
+ goto err1;
+ }
+ if (!try_module_get(phy->dev->driver->owner)) {
+ phy = ERR_PTR(-ENODEV);
devres_free(ptr);
goto err1;
}