diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-04-25 09:42:42 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-04-25 09:42:42 +0100 |
commit | a126f7c41d80322b42ae0383ed3dcb17ee0296fc (patch) | |
tree | 67f3605e72e01f7ec0b15af22d9d7b6ef8598b55 /drivers/usb/otg/otg.c | |
parent | 0098fc39e6d575f940487f09f303787efbc7a373 (diff) | |
parent | a7eb7c6f9a657a01a8359edae31bbeacd18b072c (diff) | |
download | blackbird-op-linux-a126f7c41d80322b42ae0383ed3dcb17ee0296fc.tar.gz blackbird-op-linux-a126f7c41d80322b42ae0383ed3dcb17ee0296fc.zip |
Merge branch 'mcpm' of git://git.linaro.org/people/nico/linux into devel-stable
Diffstat (limited to 'drivers/usb/otg/otg.c')
-rw-r--r-- | drivers/usb/otg/otg.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/usb/otg/otg.c b/drivers/usb/otg/otg.c index e1814397ca3a..2bd03d261a50 100644 --- a/drivers/usb/otg/otg.c +++ b/drivers/usb/otg/otg.c @@ -130,7 +130,7 @@ struct usb_phy *usb_get_phy(enum usb_phy_type type) spin_lock_irqsave(&phy_lock, flags); phy = __usb_find_phy(&phy_list, type); - if (IS_ERR(phy)) { + if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) { pr_err("unable to find transceiver of type %s\n", usb_phy_type_string(type)); goto err0; @@ -228,7 +228,7 @@ struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index) spin_lock_irqsave(&phy_lock, flags); phy = __usb_find_phy_dev(dev, &phy_bind_list, index); - if (IS_ERR(phy)) { + if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) { pr_err("unable to find transceiver\n"); goto err0; } @@ -301,8 +301,12 @@ EXPORT_SYMBOL(devm_usb_put_phy); */ void usb_put_phy(struct usb_phy *x) { - if (x) + if (x) { + struct module *owner = x->dev->driver->owner; + put_device(x->dev); + module_put(owner); + } } EXPORT_SYMBOL(usb_put_phy); |