Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Dan Carpenter and committed by
Felipe Balbi
4fc50ba5 6490865c

+3 -1
+3 -1
drivers/usb/gadget/function/f_midi.c
··· 611 611 612 612 do { 613 613 ret = f_midi_do_transmit(midi, ep); 614 - if (ret < 0) 614 + if (ret < 0) { 615 + spin_unlock_irqrestore(&midi->transmit_lock, flags); 615 616 goto drop_out; 617 + } 616 618 } while (ret); 617 619 618 620 spin_unlock_irqrestore(&midi->transmit_lock, flags);