Re: [PATCH 2/2] usb/dummy_hcd: don't probe for udc if hcd failed

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

 



On Thu, 14 Apr 2011, Sebastian Andrzej Siewior wrote:

> the_controller is allocated in dummy_hcd_probe() is NULL if it failed.
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> ---
>  drivers/usb/gadget/dummy_hcd.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
> index 3214ca3..a7aacf9 100644
> --- a/drivers/usb/gadget/dummy_hcd.c
> +++ b/drivers/usb/gadget/dummy_hcd.c
> @@ -874,6 +874,8 @@ static int dummy_udc_probe (struct platform_device *pdev)
>  	struct dummy	*dum = the_controller;
>  	int		rc;
>  
> +	if (!dum)
> +		return -ENODEV;
>  	usb_get_hcd(dummy_to_hcd(dum));
>  
>  	dum->gadget.name = gadget_name;

I would prefer to see this fixed by testing the_controller in init(), 
after the call to platform_device_add(the_hcd_pdev).  That way the user 
will know that initialization failed, rather than finding that things 
silently don't work.

Alan Stern

--
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