Merge https://gitlab.denx.de/u-boot/custodians/u-boot-clk
[platform/kernel/u-boot.git] / api / api_storage.c
index 8aeeda2..2b90c18 100644 (file)
@@ -99,6 +99,7 @@ static int dev_stor_get(int type, int *more, struct device_info *di)
 {
        struct blk_desc *dd;
        int found = 0;
+       int found_last = 0;
        int i = 0;
 
        /* Wasn't configured for this type, return 0 directly */
@@ -111,9 +112,13 @@ static int dev_stor_get(int type, int *more, struct device_info *di)
                        if (di->cookie ==
                            (void *)blk_get_dev(specs[type].name, i)) {
                                i += 1;
+                               found_last = 1;
                                break;
                        }
                }
+
+               if (!found_last)
+                       i = 0;
        }
 
        for (; i < specs[type].max_dev; i++) {