From: Stephen Warren <swar...@nvidia.com>

Create #define MAX_SEARCH_PARTITIONS to indicate how many partition IDs
get_device_and_partition()'s automatic mode should search through. Also,
search 1..n not 1..n-1 - it's unlikely anyone has this many partitions,
but given the loop is 1-based, including the limit seems more consistent.

Signed-off-by: Stephen Warren <swar...@nvidia.com>
---
v3: New patch.
---
 disk/part.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/disk/part.c b/disk/part.c
index 1284e1a..6caf6d2 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -435,6 +435,7 @@ void print_part (block_dev_desc_t * dev_desc)
 
 #endif
 
+#define MAX_SEARCH_PARTITIONS 16
 int get_device_and_partition(const char *ifname, const char *dev_str,
                             block_dev_desc_t **dev_desc,
                             disk_partition_t *info)
@@ -484,7 +485,7 @@ int get_device_and_partition(const char *ifname, const char 
*dev_str,
        } else {
                /* find the first bootable partition. If none are bootable,
                 * fall back to the first valid partition */
-               for (p = 1; p < 16; p++) {
+               for (p = 1; p <= MAX_SEARCH_PARTITIONS; p++) {
                        ret = get_partition_info(desc, p, info);
                        if (ret)
                                continue;
-- 
1.7.0.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to