[PATCH] usb/gadget: fix poller NPE in early polling
Jean-Christophe PLAGNIOL-VILLARD
plagnioj at jcrosoft.com
Wed Jan 18 17:56:38 EST 2012
On 21:17 Wed 18 Jan , 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 adding an extra check.
>
> Signed-off-by: Robert Jarzmik <robert.jarzmik at 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;
> }
instead of this register thee poll at the probe
Best Regards,
J.
More information about the barebox
mailing list