diff options
author | Maxime Ripard <maxime.ripard@free-electrons.com> | 2015-01-06 10:45:07 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-01-09 15:40:37 -0500 |
commit | 9c9d82492b73991e8e13a6c0af06e44816c31438 (patch) | |
tree | bb89c9a688757f0d682576312b7e74a8cf7b82b1 /drivers/usb | |
parent | 56abcab833fafcfaeb2f5b25e0364c1dec45f53e (diff) |
usb: phy: Fix deferred probing
Commit 1290a958d48e ("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 <maxime.ripard@free-electrons.com>
Tested-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/phy/phy.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c index b4066a001ba0..353c686498d4 100644 --- a/drivers/usb/phy/phy.c +++ b/drivers/usb/phy/phy.c | |||
@@ -34,7 +34,7 @@ static struct usb_phy *__usb_find_phy(struct list_head *list, | |||
34 | return phy; | 34 | return phy; |
35 | } | 35 | } |
36 | 36 | ||
37 | return ERR_PTR(-ENODEV); | 37 | return ERR_PTR(-EPROBE_DEFER); |
38 | } | 38 | } |
39 | 39 | ||
40 | static struct usb_phy *__usb_find_phy_dev(struct device *dev, | 40 | static struct usb_phy *__usb_find_phy_dev(struct device *dev, |
@@ -66,7 +66,7 @@ static struct usb_phy *__of_usb_find_phy(struct device_node *node) | |||
66 | return phy; | 66 | return phy; |
67 | } | 67 | } |
68 | 68 | ||
69 | return ERR_PTR(-ENODEV); | 69 | return ERR_PTR(-EPROBE_DEFER); |
70 | } | 70 | } |
71 | 71 | ||
72 | static void devm_usb_phy_release(struct device *dev, void *res) | 72 | static void devm_usb_phy_release(struct device *dev, void *res) |
@@ -192,7 +192,7 @@ struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev, | |||
192 | phy = __of_usb_find_phy(node); | 192 | phy = __of_usb_find_phy(node); |
193 | if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) { | 193 | if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) { |
194 | if (!IS_ERR(phy)) | 194 | if (!IS_ERR(phy)) |
195 | phy = ERR_PTR(-EPROBE_DEFER); | 195 | phy = ERR_PTR(-ENODEV); |
196 | 196 | ||
197 | devres_free(ptr); | 197 | devres_free(ptr); |
198 | goto err1; | 198 | goto err1; |