Commit c67c2ed8 authored by Peter Chen's avatar Peter Chen Committed by Greg Kroah-Hartman

usb: gadget: f_uac2: fix error handling at afunc_bind

commit f1d3861d upstream.

The current error handling flow uses incorrect goto label, fix it

Fixes: d12a8727 ("usb: gadget: function: Remove redundant usb_free_all_descriptors")
Signed-off-by: default avatarPeter Chen <peter.chen@nxp.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 747b3152
...@@ -1079,13 +1079,13 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn) ...@@ -1079,13 +1079,13 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn)
agdev->out_ep = usb_ep_autoconfig(gadget, &fs_epout_desc); agdev->out_ep = usb_ep_autoconfig(gadget, &fs_epout_desc);
if (!agdev->out_ep) { if (!agdev->out_ep) {
dev_err(dev, "%s:%d Error!\n", __func__, __LINE__); dev_err(dev, "%s:%d Error!\n", __func__, __LINE__);
goto err; return ret;
} }
agdev->in_ep = usb_ep_autoconfig(gadget, &fs_epin_desc); agdev->in_ep = usb_ep_autoconfig(gadget, &fs_epin_desc);
if (!agdev->in_ep) { if (!agdev->in_ep) {
dev_err(dev, "%s:%d Error!\n", __func__, __LINE__); dev_err(dev, "%s:%d Error!\n", __func__, __LINE__);
goto err; return ret;
} }
uac2->p_prm.uac2 = uac2; uac2->p_prm.uac2 = uac2;
...@@ -1102,7 +1102,7 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn) ...@@ -1102,7 +1102,7 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn)
ret = usb_assign_descriptors(fn, fs_audio_desc, hs_audio_desc, NULL); ret = usb_assign_descriptors(fn, fs_audio_desc, hs_audio_desc, NULL);
if (ret) if (ret)
goto err; return ret;
prm = &agdev->uac2.c_prm; prm = &agdev->uac2.c_prm;
prm->max_psize = hs_epout_desc.wMaxPacketSize; prm->max_psize = hs_epout_desc.wMaxPacketSize;
...@@ -1117,19 +1117,19 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn) ...@@ -1117,19 +1117,19 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn)
prm->rbuf = kzalloc(prm->max_psize * USB_XFERS, GFP_KERNEL); prm->rbuf = kzalloc(prm->max_psize * USB_XFERS, GFP_KERNEL);
if (!prm->rbuf) { if (!prm->rbuf) {
prm->max_psize = 0; prm->max_psize = 0;
goto err_free_descs; goto err;
} }
ret = alsa_uac2_init(agdev); ret = alsa_uac2_init(agdev);
if (ret) if (ret)
goto err_free_descs; goto err;
return 0; return 0;
err_free_descs:
usb_free_all_descriptors(fn);
err: err:
kfree(agdev->uac2.p_prm.rbuf); kfree(agdev->uac2.p_prm.rbuf);
kfree(agdev->uac2.c_prm.rbuf); kfree(agdev->uac2.c_prm.rbuf);
err_free_descs:
usb_free_all_descriptors(fn);
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment