Skip to content

Commit

Permalink
usb: phy: Fix deferred probing
Browse files Browse the repository at this point in the history
Commit 1290a95 ("usb: phy: propagate __of_usb_find_phy()'s error on
failure") actually broke the deferred probing mechanism, since it now returns
EPROBE_DEFER only when the try_module_get call fails, but not when the phy
lookup does.

All the other similar functions seem to return ENODEV when try_module_get
fails, and the error code of either __usb_find_phy or __of_usb_find_phy
otherwise.

In order to have a consistent behaviour, and a meaningful EPROBE_DEFER, always
return EPROBE_DEFER when __(of_)usb_find_phy fails to look up the requested
phy, that will be propagated by the caller, and ENODEV if try_module_get fails.

Signed-off-by: Maxime Ripard <[email protected]>
Tested-by: Olof Johansson <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
mripard authored and gregkh committed Jan 9, 2015
1 parent 56abcab commit 9c9d824
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/usb/phy/phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static struct usb_phy *__usb_find_phy(struct list_head *list,
return phy;
}

return ERR_PTR(-ENODEV);
return ERR_PTR(-EPROBE_DEFER);
}

static struct usb_phy *__usb_find_phy_dev(struct device *dev,
Expand Down Expand Up @@ -66,7 +66,7 @@ static struct usb_phy *__of_usb_find_phy(struct device_node *node)
return phy;
}

return ERR_PTR(-ENODEV);
return ERR_PTR(-EPROBE_DEFER);
}

static void devm_usb_phy_release(struct device *dev, void *res)
Expand Down Expand Up @@ -192,7 +192,7 @@ struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev,
phy = __of_usb_find_phy(node);
if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) {
if (!IS_ERR(phy))
phy = ERR_PTR(-EPROBE_DEFER);
phy = ERR_PTR(-ENODEV);

devres_free(ptr);
goto err1;
Expand Down

0 comments on commit 9c9d824

Please sign in to comment.