summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2014-09-22 00:33:13 +0200
committerBrian Norris <computersforpeace@gmail.com>2014-10-22 02:04:34 -0700
commita1ff7d64c5361c15bac653708a679de13506d283 (patch)
tree33ee6b22a0ef3fcac28052378adf9116746234ea /drivers/mtd
parentb85b8d92c1d720a5b2229aa1bad9bd77f09b8ec5 (diff)
downloadop-kernel-dev-a1ff7d64c5361c15bac653708a679de13506d283.zip
op-kernel-dev-a1ff7d64c5361c15bac653708a679de13506d283.tar.gz
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>
Diffstat (limited to 'drivers/mtd')
-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 f2db4d7..cc13ea5 100644
--- a/drivers/mtd/bcm47xxpart.c
+++ b/drivers/mtd/bcm47xxpart.c
@@ -172,18 +172,26 @@ static int bcm47xxpart_parse(struct mtd_info *master,
i++;
}
- bcm47xxpart_add_part(&parts[curr_part++], "linux",
- offset + trx->offset[i], 0);
- i++;
+ if (trx->offset[i]) {
+ bcm47xxpart_add_part(&parts[curr_part++],
+ "linux",
+ offset + trx->offset[i],
+ 0);
+ i++;
+ }
/*
* Pure rootfs size is known and can be calculated as:
* trx->length - trx->offset[i]. We don't fill it as
* we want to have jffs2 (overlay) in the same mtd.
*/
- bcm47xxpart_add_part(&parts[curr_part++], "rootfs",
- offset + trx->offset[i], 0);
- i++;
+ if (trx->offset[i]) {
+ bcm47xxpart_add_part(&parts[curr_part++],
+ "rootfs",
+ offset + trx->offset[i],
+ 0);
+ i++;
+ }
last_trx_part = curr_part - 1;
OpenPOWER on IntegriCloud