usb: gadget: f_uac2: fix error handling at afunc_bind
authorPeter Chen <peter.chen@nxp.com>
Tue, 8 Nov 2016 02:10:44 +0000 (10:10 +0800)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Fri, 18 Nov 2016 11:54:09 +0000 (13:54 +0200)
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>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/function/f_uac2.c

index cd214ec8a601b4913b67f7d67e52fb8c57e003c4..969cfe7413808c5b1bcc421b56d60fb6db65e57d 100644 (file)
@@ -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,7 +1091,7 @@ 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;
 
        prm = &agdev->uac2.c_prm;
        prm->max_psize = hs_epout_desc.wMaxPacketSize;
@@ -1106,19 +1106,19 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn)
        prm->rbuf = kzalloc(prm->max_psize * USB_XFERS, GFP_KERNEL);
        if (!prm->rbuf) {
                prm->max_psize = 0;
-               goto err_free_descs;
+               goto err;
        }
 
        ret = alsa_uac2_init(agdev);
        if (ret)
-               goto err_free_descs;
+               goto err;
        return 0;
 
-err_free_descs:
-       usb_free_all_descriptors(fn);
 err:
        kfree(agdev->uac2.p_prm.rbuf);
        kfree(agdev->uac2.c_prm.rbuf);
+err_free_descs:
+       usb_free_all_descriptors(fn);
        return -EINVAL;
 }