summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2016-04-02 07:51:08 +0300
committerFelipe Balbi <felipe.balbi@linux.intel.com>2016-04-04 15:18:37 +0300
commit4fc50ba5965ac2b360499d4a23eb10d04414dd36 (patch)
tree1a59f269b569aef2b01b74546e6a9adfa540f0ea
parent6490865c67825277b29638e839850882600b48ec (diff)
downloadlinux-4fc50ba5965ac2b360499d4a23eb10d04414dd36.tar.gz
linux-4fc50ba5965ac2b360499d4a23eb10d04414dd36.tar.bz2
linux-4fc50ba5965ac2b360499d4a23eb10d04414dd36.zip
usb: gadget: f_midi: unlock on error
We added some new locking here, but missed an error path where we need to unlock. Fixes: 9acdf4df2fc4 ('usb: gadget: f_midi: added spinlock on transmit function') Acked-by: Michal Nazarewicz <mina86@mina86.com> Acked-by: Felipe F. Tonello <eu@felipetonello.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
-rw-r--r--drivers/usb/gadget/function/f_midi.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
index 9ad51dcab982..58fc199a18ec 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -611,8 +611,10 @@ static void f_midi_transmit(struct f_midi *midi)
do {
ret = f_midi_do_transmit(midi, ep);
- if (ret < 0)
+ if (ret < 0) {
+ spin_unlock_irqrestore(&midi->transmit_lock, flags);
goto drop_out;
+ }
} while (ret);
spin_unlock_irqrestore(&midi->transmit_lock, flags);