usb: gadget: f_midi: fix in_last_port looping logic
authorMichal Nazarewicz <mina86@mina86.com>
Mon, 18 Jan 2016 17:30:15 +0000 (18:30 +0100)
committerFelipe Balbi <balbi@kernel.org>
Fri, 4 Mar 2016 13:14:33 +0000 (15:14 +0200)
commit06cd928b0cfc79e9e17e0d36e39329e20238b185
treefed2b16bdfb4c45e98df7934699416c2c65ad806
parent9a71eb563441a42effe11d9a8cc1e6be068b7446
usb: gadget: f_midi: fix in_last_port looping logic

In general case, all of midi->in_port pointers may be non-NULL which
implies that the ‘if (\!port)’ condition will never execute thus never
zeroing midi->in_last_port.  Fix by rewriting the loop such that the
field is set to zero if \!port or end of loop has been reached.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
drivers/usb/gadget/function/f_midi.c