mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH V2] usb/gadget: fix poller NPE in early polling
Date: Thu, 19 Jan 2012 16:11:10 +0100	[thread overview]
Message-ID: <4F18328E.9080404@pengutronix.de> (raw)
In-Reply-To: <1326972208-438-1-git-send-email-robert.jarzmik@free.fr>


[-- Attachment #1.1: Type: text/plain, Size: 2174 bytes --]

On 01/19/2012 12:23 PM, Robert Jarzmik wrote:
> 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();

one tab should be enough.

> +}
> +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;
>  }
>  

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

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

  reply	other threads:[~2012-01-19 15:11 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   ` [PATCH V2] " Robert Jarzmik
2012-01-19 15:11     ` Marc Kleine-Budde [this message]
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=4F18328E.9080404@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=robert.jarzmik@free.fr \
    /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