Skip to content

Commit

Permalink
usb: gadget: f_mass_storage: Fix the logic to iterate all common->luns
Browse files Browse the repository at this point in the history
It is wrong to do --i in the for loop.

Fixes: dd02ea5 ("usb: gadget: mass_storage: Use static array for luns")
Signed-off-by: Axel Lin <[email protected]>
Reviewed-by: Krzysztof Opasiak <[email protected]>
Acked-by: Michal Nazarewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
  • Loading branch information
AxelLin authored and Felipe Balbi committed Jul 17, 2017
1 parent ee249b4 commit bee9186
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/usb/gadget/function/f_mass_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -2490,7 +2490,7 @@ static int fsg_main_thread(void *common_)
int i;

down_write(&common->filesem);
for (i = 0; i < ARRAY_SIZE(common->luns); --i) {
for (i = 0; i < ARRAY_SIZE(common->luns); i++) {
struct fsg_lun *curlun = common->luns[i];
if (!curlun || !fsg_lun_is_open(curlun))
continue;
Expand Down

0 comments on commit bee9186

Please sign in to comment.