For loop below is:

        for (lun=0; lun<=us->max_lun; lun++)
            ...

so we need to set max_lun to 0 in order to default to having only one
LUN. Otherwise, we end up assuming the device has 2 valid LUNs.

Signed-off-by: Andrey Smirnov <[email protected]>
---
 drivers/usb/storage/usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index fda24d616..79561ee6f 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -439,7 +439,7 @@ static int usb_stor_scan(struct usb_device *usbdev, struct 
us_data *us)
        int num_devs = 0;
 
        /* obtain the max LUN */
-       us->max_lun = 1;
+       us->max_lun = 0;
        if (us->protocol == US_PR_BULK)
                us->max_lun = usb_stor_Bulk_max_lun(us);
 
-- 
2.21.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to