Commit 2c4e3dbf63b39d44a291db70016c718f45d9cd46

Authored by Arjun Sreedharan
Committed by Felipe Balbi
1 parent 7d1311b93e

usb: phy: return -ENODEV on failure of try_module_get

When __usb_find_phy_dev() does not return error and
try_module_get() fails, return -ENODEV.

Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>

Showing 1 changed file with 3 additions and 0 deletions Side-by-side Diff

drivers/usb/phy/phy.c
... ... @@ -232,6 +232,9 @@
232 232 phy = __usb_find_phy_dev(dev, &phy_bind_list, index);
233 233 if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) {
234 234 dev_dbg(dev, "unable to find transceiver\n");
  235 + if (!IS_ERR(phy))
  236 + phy = ERR_PTR(-ENODEV);
  237 +
235 238 goto err0;
236 239 }
237 240