aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2014-09-21 18:33:13 -0400
committerBrian Norris <computersforpeace@gmail.com>2014-10-22 05:04:34 -0400
commita1ff7d64c5361c15bac653708a679de13506d283 (patch)
tree33ee6b22a0ef3fcac28052378adf9116746234ea
parentb85b8d92c1d720a5b2229aa1bad9bd77f09b8ec5 (diff)
mtd: bcm47xxpart: only register partitions if the trx header was filled
Sometimes the trx offsets are 0, in that case there is no partition and we should not try to add one. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> [Brian: rewrapped] Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-rw-r--r--drivers/mtd/bcm47xxpart.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c
index f2db4d7d6c36..cc13ea5ce4d5 100644
--- a/drivers/mtd/bcm47xxpart.c
+++ b/drivers/mtd/bcm47xxpart.c
@@ -172,18 +172,26 @@ static int bcm47xxpart_parse(struct mtd_info *master,
172 i++; 172 i++;
173 } 173 }
174 174
175 bcm47xxpart_add_part(&parts[curr_part++], "linux", 175 if (trx->offset[i]) {
176 offset + trx->offset[i], 0); 176 bcm47xxpart_add_part(&parts[curr_part++],
177 i++; 177 "linux",
178 offset + trx->offset[i],
179 0);
180 i++;
181 }
178 182
179 /* 183 /*
180 * Pure rootfs size is known and can be calculated as: 184 * Pure rootfs size is known and can be calculated as:
181 * trx->length - trx->offset[i]. We don't fill it as 185 * trx->length - trx->offset[i]. We don't fill it as
182 * we want to have jffs2 (overlay) in the same mtd. 186 * we want to have jffs2 (overlay) in the same mtd.
183 */ 187 */
184 bcm47xxpart_add_part(&parts[curr_part++], "rootfs", 188 if (trx->offset[i]) {
185 offset + trx->offset[i], 0); 189 bcm47xxpart_add_part(&parts[curr_part++],
186 i++; 190 "rootfs",
191 offset + trx->offset[i],
192 0);
193 i++;
194 }
187 195
188 last_trx_part = curr_part - 1; 196 last_trx_part = curr_part - 1;
189 197