All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Peter Chen <peter.chen@nxp.com>
Cc: linux-usb@vger.kernel.org, Peter Chen <peter.chen@nxp.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH 1/1] usb: gadget: f_uac2: fix error handling at afunc_bind
Date: Thu, 03 Nov 2016 10:50:23 +0200	[thread overview]
Message-ID: <874m3pne0g.fsf@linux.intel.com> (raw)
In-Reply-To: <1477471565-22087-1-git-send-email-peter.chen@nxp.com>

[-- Attachment #1: Type: text/plain, Size: 1768 bytes --]


Hi,

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

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]

  reply	other threads:[~2016-11-03  8:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-26  8:46 [PATCH 1/1] usb: gadget: f_uac2: fix error handling at afunc_bind Peter Chen
2016-11-03  8:50 ` Felipe Balbi [this message]
2016-11-03  9:20   ` Peter Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874m3pne0g.fsf@linux.intel.com \
    --to=balbi@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=peter.chen@nxp.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.