[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1451502475-22794-5-git-send-email-eu@felipetonello.com>
Date: Wed, 30 Dec 2015 19:07:55 +0000
From: "Felipe F. Tonello" <eu@...ipetonello.com>
To: linux-usb@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Felipe Balbi <balbi@...com>,
Robert Baldyga <r.baldyga@...sung.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Clemens Ladisch <clemens@...isch.de>
Subject: [PATCH 4/4] usb: gadget: f_midi: add mutex_unlock under setup_fail label
This ensures that at any point on the function if a goto to setup_fail is
made, it will unlock the mutex.
Signed-off-by: Felipe F. Tonello <eu@...ipetonello.com>
---
drivers/usb/gadget/function/f_midi.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
index b7d3f5a10bf0..1255f8a898d0 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -1251,7 +1251,6 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi)
if (!port) {
status = -ENOMEM;
- mutex_unlock(&opts->lock);
goto setup_fail;
}
@@ -1264,7 +1263,6 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi)
midi->id = kstrdup(opts->id, GFP_KERNEL);
if (opts->id && !midi->id) {
status = -ENOMEM;
- mutex_unlock(&opts->lock);
goto setup_fail;
}
midi->in_ports = opts->in_ports;
@@ -1293,6 +1291,7 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi)
return &midi->func;
setup_fail:
+ mutex_unlock(&opts->lock);
for (--i; i >= 0; i--)
kfree(midi->in_port[i]);
kfree(midi);
--
2.6.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists