mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Robert Jarzmik <robert.jarzmik@free.fr>
To: barebox@lists.infradead.org, plagnioj@jcrosoft.com
Subject: [PATCH V2] usb/gadget: fix poller NPE in early polling
Date: Thu, 19 Jan 2012 12:23:27 +0100	[thread overview]
Message-ID: <1326972208-438-1-git-send-email-robert.jarzmik@free.fr> (raw)
In-Reply-To: <20120118225638.GJ25622@game.jcrosoft.org>

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 moving poller registration after driver probe.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>

---
Since V1: Review by Jean-Christophe
---
 drivers/usb/gadget/pxa27x_udc.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c
index d0dbee9..10483c5 100644
--- a/drivers/usb/gadget/pxa27x_udc.c
+++ b/drivers/usb/gadget/pxa27x_udc.c
@@ -1473,6 +1473,14 @@ static struct pxa_udc memory = {
 	}
 };
 
+static int pxa27x_udc_poller(struct poller_struct *poller)
+{
+		return usb_gadget_poll();
+}
+static struct poller_struct poller = {
+	.func		= pxa27x_udc_poller
+};
+
 static int __init pxa_udc_probe(struct device_d *dev)
 {
 	struct pxa_udc *udc = &memory;
@@ -1496,6 +1504,8 @@ static int __init pxa_udc_probe(struct device_d *dev)
 	the_controller = udc;
 	udc_init_data(udc);
 	pxa_eps_setup(udc);
+	poller_register(&poller);
+
 	return 0;
 }
 
@@ -1506,18 +1516,9 @@ static struct driver_d udc_driver = {
 	.probe		= pxa_udc_probe,
 };
 
-static int pxa27x_udc_poller(struct poller_struct *poller)
-{
-	return usb_gadget_poll();
-}
-static struct poller_struct poller = {
-	.func		= pxa27x_udc_poller
-};
-
 static int __init pxa27x_udc_init(void)
 {
 	register_driver(&udc_driver);
-	poller_register(&poller);
 	return 0;
 }
 
-- 
1.7.5.4


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

  reply	other threads:[~2012-01-19 11:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-18 20:17 [PATCH] " Robert Jarzmik
2012-01-18 22:56 ` Jean-Christophe PLAGNIOL-VILLARD
2012-01-19 11:23   ` Robert Jarzmik [this message]
2012-01-19 15:11     ` [PATCH V2] " 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=1326972208-438-1-git-send-email-robert.jarzmik@free.fr \
    --to=robert.jarzmik@free.fr \
    --cc=barebox@lists.infradead.org \
    --cc=plagnioj@jcrosoft.com \
    /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