mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Robert Jarzmik <robert.jarzmik@free.fr>
To: barebox@lists.infradead.org
Subject: [PATCH] usb/gadget: fix poller NPE in early polling
Date: Wed, 18 Jan 2012 21:17:39 +0100	[thread overview]
Message-ID: <1326917859-25058-1-git-send-email-robert.jarzmik@free.fr> (raw)

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

             reply	other threads:[~2012-01-18 20:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-18 20:17 Robert Jarzmik [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1326917859-25058-1-git-send-email-robert.jarzmik@free.fr \
    --to=robert.jarzmik@free.fr \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox