Re: [PATCH] usb/chipidea: fix oops on memory allocation failure

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

 



On Thu, Oct 17, 2013 at 01:50:17PM +0800, Peter Chen wrote:
> Below is my proposal fix for this problem: 
> 
> diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
> index 42a0bd4..c1d05c4 100644
> --- a/drivers/usb/chipidea/host.c
> +++ b/drivers/usb/chipidea/host.c
> @@ -270,16 +270,18 @@ static void host_stop(struct ci_hdrc *ci)
>  {
>  	struct usb_hcd *hcd = ci->hcd;
>  
> -	usb_remove_hcd(hcd);
> -	usb_put_hcd(hcd);
> -	if (ci->platdata->reg_vbus)
> -		regulator_disable(ci->platdata->reg_vbus);
> +	if (hcd) {
> +		usb_remove_hcd(hcd);
> +		usb_put_hcd(hcd);
> +		if (ci->platdata->reg_vbus)
> +			regulator_disable(ci->platdata->reg_vbus);
> +	}
>  }
>  
>  
>  void ci_hdrc_host_destroy(struct ci_hdrc *ci)
>  {
> -	if (ci->role == CI_ROLE_HOST)
> +	if (ci->role == CI_ROLE_HOST && ci->hcd)
>  		host_stop(ci);

If you're not calling host_stop() unless ci->hcd is setup, then you
don't need to check for that in host_stop() ?  Note that my oopsing
path is through the above function.

Anyway, Greg has already taken my patch from yesterday.
--
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