summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/f_midi.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/gadget/f_midi.c b/drivers/usb/gadget/f_midi.c
index ef1bc7a174ef..67b222908cf9 100644
--- a/drivers/usb/gadget/f_midi.c
+++ b/drivers/usb/gadget/f_midi.c
@@ -951,7 +951,7 @@ int __init f_midi_bind_config(struct usb_configuration *c,
struct gmidi_in_port *port = kzalloc(sizeof(*port), GFP_KERNEL);
if (!port) {
status = -ENOMEM;
- goto fail;
+ goto setup_fail;
}
port->midi = midi;
@@ -989,6 +989,8 @@ int __init f_midi_bind_config(struct usb_configuration *c,
return 0;
setup_fail:
+ for (--i; i >= 0; i--)
+ kfree(midi->in_port[i]);
kfree(midi);
fail:
return status;