Skip to content

Commit

Permalink
mtd: bcm47xxpart: only register partitions if the trx header was filled
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hauke Mehrtens authored and Brian Norris committed Oct 22, 2014
1 parent b85b8d9 commit a1ff7d6
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions drivers/mtd/bcm47xxpart.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit a1ff7d6

Please sign in to comment.