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

usb: gadget: f_mass_storage: Fix the logic to iterate all common->luns

It is wrong to do --i in the for loop.

Fixes: dd02ea5a3305 ("usb: gadget: mass_storage: Use static array for luns")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>

authored by

Axel Lin and committed by
Felipe Balbi
bee91869 ee249b45

+1 -1
+1 -1
drivers/usb/gadget/function/f_mass_storage.c
··· 2490 2490 int i; 2491 2491 2492 2492 down_write(&common->filesem); 2493 - for (i = 0; i < ARRAY_SIZE(common->luns); --i) { 2493 + for (i = 0; i < ARRAY_SIZE(common->luns); i++) { 2494 2494 struct fsg_lun *curlun = common->luns[i]; 2495 2495 if (!curlun || !fsg_lun_is_open(curlun)) 2496 2496 continue;