Re: [PATCH] pxa27x_udc: Fix bug on remove path without transceiver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sunday 05 April 2009, Robert Jarzmik wrote:
> In the case where the pxa27x_udc gadget driver is removed
> while no transceiver was found at probe time, the
> otg_put_transceiver() function should not be called.
> 
> If incorrectly called, a NULL dereference pointer is thrown
> on driver removal.

A better fix would be to otg_put_transceiver() ... check
for null there, once.  Could you do it that way instead?


> Signed-off-by: Robert Jarzmik <robert.jarzmik@xxxxxxx>
> ---
>  drivers/usb/gadget/pxa27x_udc.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c
> index 1de0e85..5ba8291 100644
> --- a/drivers/usb/gadget/pxa27x_udc.c
> +++ b/drivers/usb/gadget/pxa27x_udc.c
> @@ -2474,7 +2474,8 @@ static int __exit pxa_udc_remove(struct platform_device *_dev)
>  	if (gpio_is_valid(gpio))
>  		gpio_free(gpio);
>  
> -	otg_put_transceiver(udc->transceiver);
> +	if (udc->transceiver)
> +		otg_put_transceiver(udc->transceiver);
>  
>  	udc->transceiver = NULL;
>  	platform_set_drvdata(_dev, NULL);
> -- 
> 1.5.6.5
> 
> 



--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux