usb: gadget: f_midi: unlock on error
authorDan Carpenter <dan.carpenter@oracle.com>
Sat, 2 Apr 2016 04:51:08 +0000 (07:51 +0300)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 4 Apr 2016 12:18:37 +0000 (15:18 +0300)
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>
drivers/usb/gadget/function/f_midi.c

index 9ad51dcab98249b361a9b9005878d88a6f3f1890..58fc199a18ecd735021796ed4c352f7f728d0e22 100644 (file)
@@ -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);