summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>2015-07-03 14:02:29 +0200
committerFelipe Balbi <balbi@ti.com>2015-07-06 12:34:08 -0500
commitb2e2c94b878be2500d4d42c1f52a2fa1fe7648b4 (patch)
tree5da31c96bcaee62996db2d22e6e2327d8be1321a /drivers/usb
parent543aa4867d4a2dff5fc11e1b688197ee3bad7f89 (diff)
downloadop-kernel-dev-b2e2c94b878be2500d4d42c1f52a2fa1fe7648b4.zip
op-kernel-dev-b2e2c94b878be2500d4d42c1f52a2fa1fe7648b4.tar.gz
usb: gadget: f_midi: fix error recovery path
In case kstrdup() fails the resources to release are midi->in_port[] and midi. No cards have been registered, so no need to unregister any. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/function/f_midi.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
index 6316aa5..ad50a67 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -1145,7 +1145,7 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi)
if (opts->id && !midi->id) {
status = -ENOMEM;
mutex_unlock(&opts->lock);
- goto kstrdup_fail;
+ goto setup_fail;
}
midi->in_ports = opts->in_ports;
midi->out_ports = opts->out_ports;
@@ -1164,8 +1164,6 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi)
return &midi->func;
-kstrdup_fail:
- f_midi_unregister_card(midi);
setup_fail:
for (--i; i >= 0; i--)
kfree(midi->in_port[i]);
OpenPOWER on IntegriCloud