mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] usb/gadget: fix poller NPE in early polling
@ 2012-01-18 20:17 Robert Jarzmik
  2012-01-18 22:56 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 8+ messages in thread
From: Robert Jarzmik @ 2012-01-18 20:17 UTC (permalink / raw)
  To: barebox

The timings of the poller calling have changed, digging out
a latent bug in pxa27x udc controller.
The polling routine is called before the probe function is
called, and the driver internal are not initialized at that
time. This triggers a NULL pointer exception.

Fix it by adding an extra check.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 drivers/usb/gadget/pxa27x_udc.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c
index d0dbee9..bde9e74 100644
--- a/drivers/usb/gadget/pxa27x_udc.c
+++ b/drivers/usb/gadget/pxa27x_udc.c
@@ -1508,7 +1508,10 @@ static struct driver_d udc_driver = {
 
 static int pxa27x_udc_poller(struct poller_struct *poller)
 {
-	return usb_gadget_poll();
+	if (the_controller)
+		return usb_gadget_poll();
+	else
+		return 0;
 }
 static struct poller_struct poller = {
 	.func		= pxa27x_udc_poller
-- 
1.7.5.4


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

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

end of thread, other threads:[~2012-01-23 16:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-18 20:17 [PATCH] usb/gadget: fix poller NPE in early polling Robert Jarzmik
2012-01-18 22:56 ` Jean-Christophe PLAGNIOL-VILLARD
2012-01-19 11:23   ` [PATCH V2] " Robert Jarzmik
2012-01-19 15:11     ` Marc Kleine-Budde
2012-01-20 20:17       ` [PATCH V3] " Robert Jarzmik
2012-01-23  8:48         ` Sascha Hauer
2012-01-23 16:25           ` Robert Jarzmik
2012-01-23 10:38         ` Jean-Christophe PLAGNIOL-VILLARD

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