]>
Commit | Line | Data |
---|---|---|
86ab591e GKH |
1 | From f1d3861d63a5d79b8968a02eea1dcb01bb684e62 Mon Sep 17 00:00:00 2001 |
2 | From: Peter Chen <peter.chen@nxp.com> | |
3 | Date: Tue, 8 Nov 2016 10:10:44 +0800 | |
4 | Subject: usb: gadget: f_uac2: fix error handling at afunc_bind | |
5 | ||
6 | From: Peter Chen <peter.chen@nxp.com> | |
7 | ||
8 | commit f1d3861d63a5d79b8968a02eea1dcb01bb684e62 upstream. | |
9 | ||
10 | The current error handling flow uses incorrect goto label, fix it | |
11 | ||
12 | Fixes: d12a8727171c ("usb: gadget: function: Remove redundant usb_free_all_descriptors") | |
13 | Signed-off-by: Peter Chen <peter.chen@nxp.com> | |
14 | Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com> | |
15 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
16 | ||
17 | --- | |
18 | drivers/usb/gadget/function/f_uac2.c | 14 +++++++------- | |
19 | 1 file changed, 7 insertions(+), 7 deletions(-) | |
20 | ||
21 | --- a/drivers/usb/gadget/function/f_uac2.c | |
22 | +++ b/drivers/usb/gadget/function/f_uac2.c | |
23 | @@ -1067,13 +1067,13 @@ afunc_bind(struct usb_configuration *cfg | |
24 | agdev->out_ep = usb_ep_autoconfig(gadget, &fs_epout_desc); | |
25 | if (!agdev->out_ep) { | |
26 | dev_err(dev, "%s:%d Error!\n", __func__, __LINE__); | |
27 | - goto err; | |
28 | + return ret; | |
29 | } | |
30 | ||
31 | agdev->in_ep = usb_ep_autoconfig(gadget, &fs_epin_desc); | |
32 | if (!agdev->in_ep) { | |
33 | dev_err(dev, "%s:%d Error!\n", __func__, __LINE__); | |
34 | - goto err; | |
35 | + return ret; | |
36 | } | |
37 | ||
38 | uac2->p_prm.uac2 = uac2; | |
39 | @@ -1091,7 +1091,7 @@ afunc_bind(struct usb_configuration *cfg | |
40 | ret = usb_assign_descriptors(fn, fs_audio_desc, hs_audio_desc, NULL, | |
41 | NULL); | |
42 | if (ret) | |
43 | - goto err; | |
44 | + return ret; | |
45 | ||
46 | prm = &agdev->uac2.c_prm; | |
47 | prm->max_psize = hs_epout_desc.wMaxPacketSize; | |
48 | @@ -1106,19 +1106,19 @@ afunc_bind(struct usb_configuration *cfg | |
49 | prm->rbuf = kzalloc(prm->max_psize * USB_XFERS, GFP_KERNEL); | |
50 | if (!prm->rbuf) { | |
51 | prm->max_psize = 0; | |
52 | - goto err_free_descs; | |
53 | + goto err; | |
54 | } | |
55 | ||
56 | ret = alsa_uac2_init(agdev); | |
57 | if (ret) | |
58 | - goto err_free_descs; | |
59 | + goto err; | |
60 | return 0; | |
61 | ||
62 | -err_free_descs: | |
63 | - usb_free_all_descriptors(fn); | |
64 | err: | |
65 | kfree(agdev->uac2.p_prm.rbuf); | |
66 | kfree(agdev->uac2.c_prm.rbuf); | |
67 | +err_free_descs: | |
68 | + usb_free_all_descriptors(fn); | |
69 | return -EINVAL; | |
70 | } | |
71 |