public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] mtd: bcm47xxpart: only register partitions if the trx header was filled
@ 2014-09-21 22:33 Hauke Mehrtens
  2014-09-22 18:28 ` Brian Norris
  2014-09-23 12:27 ` Rafał Miłecki
  0 siblings, 2 replies; 4+ messages in thread
From: Hauke Mehrtens @ 2014-09-21 22:33 UTC (permalink / raw)
  To: computersforpeace
  Cc: Hauke Mehrtens, zajec5, linux-mtd, David.Woodhouse, dedekind1

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>
---
 drivers/mtd/bcm47xxpart.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c
index 8057f52..c3f4454 100644
--- a/drivers/mtd/bcm47xxpart.c
+++ b/drivers/mtd/bcm47xxpart.c
@@ -168,18 +168,22 @@ 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;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-10-22  9:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-21 22:33 [PATCH] mtd: bcm47xxpart: only register partitions if the trx header was filled Hauke Mehrtens
2014-09-22 18:28 ` Brian Norris
2014-09-23 12:27 ` Rafał Miłecki
2014-10-22  9:05   ` Brian Norris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox