public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb:phy: propagate __of_usb_find_phy()'s error on failure
@ 2014-11-20 15:53 Arjun Sreedharan
  2014-11-20 19:39 ` Felipe Balbi
  2014-11-24 13:10 ` Thierry Reding
  0 siblings, 2 replies; 8+ messages in thread
From: Arjun Sreedharan @ 2014-11-20 15:53 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel

When __of_usb_find_phy() fails, it returns -ENODEV - its
error code has to be returned by devm_usb_get_phy_by_phandle().
Only when the former function succeeds and try_module_get()
fails should -EPROBE_DEFER be returned.

Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>
---
 drivers/usb/phy/phy.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c
index 045cd30..0310112 100644
--- a/drivers/usb/phy/phy.c
+++ b/drivers/usb/phy/phy.c
@@ -191,7 +191,9 @@ 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)) {
-		phy = ERR_PTR(-EPROBE_DEFER);
+		if (!IS_ERR(phy))
+			phy = ERR_PTR(-EPROBE_DEFER);
+		
 		devres_free(ptr);
 		goto err1;
 	}
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-11-24 15:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-20 15:53 [PATCH] usb:phy: propagate __of_usb_find_phy()'s error on failure Arjun Sreedharan
2014-11-20 19:39 ` Felipe Balbi
     [not found]   ` <CAJFMrCGbUQar751mOZOJ5Fy=HEDb+L7XjQypJxzyE72T=qoDmw@mail.gmail.com>
2014-11-21 15:03     ` Felipe Balbi
2014-11-24 13:10 ` Thierry Reding
2014-11-24 14:36   ` Felipe Balbi
2014-11-24 15:16     ` Thierry Reding
2014-11-24 15:36       ` Felipe Balbi
2014-11-24 15:37         ` Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox