[PATCH 3/4] USB gadget: fsl: Bail out if no udc exists

Sascha Hauer s.hauer at pengutronix.de
Thu Feb 13 04:42:52 EST 2014


When there is no udc registered bail out in usb_gadget_poll
instead of crashing the system.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/usb/gadget/fsl_udc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/gadget/fsl_udc.c b/drivers/usb/gadget/fsl_udc.c
index 993c7eb..50bae78 100644
--- a/drivers/usb/gadget/fsl_udc.c
+++ b/drivers/usb/gadget/fsl_udc.c
@@ -1938,6 +1938,9 @@ int usb_gadget_poll(void)
 	u32 irq_src;
 	int status = 0;
 
+	if (!udc)
+		return -ENODEV;
+
 	/* Disable ISR for OTG host mode */
 	if (udc->stopped)
 		return -EIO;
-- 
1.8.5.3




More information about the barebox mailing list