diff options
-rw-r--r-- | drivers/mtd/redboot.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/mtd/redboot.c b/drivers/mtd/redboot.c index 5a31f490368e..a459ffa1e676 100644 --- a/drivers/mtd/redboot.c +++ b/drivers/mtd/redboot.c | |||
@@ -96,6 +96,8 @@ static int parse_redboot_partitions(struct mtd_info *master, | |||
96 | */ | 96 | */ |
97 | if (swab32(buf[i].size) == master->erasesize) { | 97 | if (swab32(buf[i].size) == master->erasesize) { |
98 | int j; | 98 | int j; |
99 | /* Update numslots based on actual FIS directory size */ | ||
100 | numslots = swab32(buf[i].size) / sizeof (struct fis_image_desc); | ||
99 | for (j = 0; j < numslots; ++j) { | 101 | for (j = 0; j < numslots; ++j) { |
100 | 102 | ||
101 | /* A single 0xff denotes a deleted entry. | 103 | /* A single 0xff denotes a deleted entry. |
@@ -120,11 +122,11 @@ static int parse_redboot_partitions(struct mtd_info *master, | |||
120 | swab32s(&buf[j].desc_cksum); | 122 | swab32s(&buf[j].desc_cksum); |
121 | swab32s(&buf[j].file_cksum); | 123 | swab32s(&buf[j].file_cksum); |
122 | } | 124 | } |
125 | } else { | ||
126 | /* Update numslots based on actual FIS directory size */ | ||
127 | numslots = buf[i].size / sizeof(struct fis_image_desc); | ||
123 | } | 128 | } |
124 | break; | 129 | break; |
125 | } else if (buf[i].size != -1) { | ||
126 | /* re-calculate of real numslots */ | ||
127 | numslots = buf[i].size / sizeof(struct fis_image_desc); | ||
128 | } | 130 | } |
129 | } | 131 | } |
130 | if (i == numslots) { | 132 | if (i == numslots) { |