mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] usb: gadget: set composite to NULL when usb_gadget_register_driver fails
@ 2014-03-19 15:17 Sascha Hauer
  2014-03-19 15:17 ` [PATCH 2/2] usb: gadget: propagate error code from usb_composite_register Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2014-03-19 15:17 UTC (permalink / raw)
  To: barebox

From: Lucas Stach <dev@lynxeye.de>

So that it can be tried later again.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/usb/gadget/composite.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 11b6c18..71d0ecf 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -994,6 +994,8 @@ static struct usb_gadget_driver composite_driver = {
  */
 int usb_composite_register(struct usb_composite_driver *driver)
 {
+	int ret;
+
 	if (!driver || !driver->dev || !driver->bind || composite)
 		return -EINVAL;
 
@@ -1002,7 +1004,12 @@ int usb_composite_register(struct usb_composite_driver *driver)
 	composite_driver.function =  (char *) driver->name;
 	composite = driver;
 
-	return usb_gadget_register_driver(&composite_driver);
+	ret = usb_gadget_register_driver(&composite_driver);
+
+	if (ret)
+		composite = NULL;
+
+	return ret;
 }
 
 /**
-- 
1.9.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2014-03-19 15:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-19 15:17 [PATCH 1/2] usb: gadget: set composite to NULL when usb_gadget_register_driver fails Sascha Hauer
2014-03-19 15:17 ` [PATCH 2/2] usb: gadget: propagate error code from usb_composite_register Sascha Hauer

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