Re: [PATCH 1/1] usb: gadget: f_uac2: fix error handling at afunc_bind

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

 



Hi,

Peter Chen <peter.chen@xxxxxxx> writes:
> The current error handling flow uses incorrect goto label, fix it
>
> Cc: <stable@xxxxxxxxxxxxxxx>
> Fixes: d12a8727171c ("usb: gadget: function: Remove
> 	redundant usb_free_all_descriptors")
> Signed-off-by: Peter Chen <peter.chen@xxxxxxx>

seems like there's more than one fix here.

> ---
>  drivers/usb/gadget/function/f_uac2.c | 20 +++++++++++---------
>  1 file changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c
> index cd214ec8..3f4e478 100644
> --- a/drivers/usb/gadget/function/f_uac2.c
> +++ b/drivers/usb/gadget/function/f_uac2.c
> @@ -1067,13 +1067,13 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn)
>  	agdev->out_ep = usb_ep_autoconfig(gadget, &fs_epout_desc);
>  	if (!agdev->out_ep) {
>  		dev_err(dev, "%s:%d Error!\n", __func__, __LINE__);
> -		goto err;
> +		return ret;
>  	}
>  
>  	agdev->in_ep = usb_ep_autoconfig(gadget, &fs_epin_desc);
>  	if (!agdev->in_ep) {
>  		dev_err(dev, "%s:%d Error!\n", __func__, __LINE__);
> -		goto err;
> +		return ret;
>  	}
>  
>  	uac2->p_prm.uac2 = uac2;
> @@ -1091,13 +1091,14 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn)
>  	ret = usb_assign_descriptors(fn, fs_audio_desc, hs_audio_desc, NULL,
>  				     NULL);
>  	if (ret)
> -		goto err;
> +		return ret;

this is one fix

>  
>  	prm = &agdev->uac2.c_prm;
>  	prm->max_psize = hs_epout_desc.wMaxPacketSize;
>  	prm->rbuf = kzalloc(prm->max_psize * USB_XFERS, GFP_KERNEL);
>  	if (!prm->rbuf) {
>  		prm->max_psize = 0;
> +		ret = -ENOMEM;

but initializing ret to -ENOMEM is a separate fix altogether. 

-- 
balbi

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]