[OpenWrt-Devel] [PATCH] (BACKPORT to 3.14) mtd: bcm47xxpart: only register partitions if the trx header was filled

Stephen Parry sgparry at mainscreen.com
Fri Oct 31 14:31:18 EDT 2014


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 at hauke-m.de>
[Brian: rewrapped]
Signed-off-by: Brian Norris <computersforpeace at gmail.com>
[Stephen Parry: Backported to 3.14]
Signed-off-by: Stephen Parry <sgparry at mainscreen.com>
---
 ...art-skip_adding_partitions_for_zero_trx_offsets | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 target/linux/generic/patches-3.14/432-mtd-bcm47xxpart-skip_adding_partitions_for_zero_trx_offsets

diff --git a/target/linux/generic/patches-3.14/432-mtd-bcm47xxpart-skip_adding_partitions_for_zero_trx_offsets b/target/linux/generic/patches-3.14/432-mtd-bcm47xxpart-skip_adding_partitions_for_zero_trx_offsets
new file mode 100644
index 0000000..cc50446
--- /dev/null
+++ b/target/linux/generic/patches-3.14/432-mtd-bcm47xxpart-skip_adding_partitions_for_zero_trx_offsets
@@ -0,0 +1,39 @@
+--- a/drivers/mtd/bcm47xxpart.c
++++ b/drivers/mtd/bcm47xxpart.c
+@@ -192,20 +192,28 @@ static int bcm47xxpart_parse(struct mtd_
+ 				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.
+ 			 */
+-			name = bcm47xxpart_trx_data_part_name(master,
+-							      offset + trx->offset[i]);
+-			bcm47xxpart_add_part(&parts[curr_part++], name,
+-					     offset + trx->offset[i], 0);
+-			i++;
++			if (trx->offset[i]) {
++				name = bcm47xxpart_trx_data_part_name(master,
++								offset + trx->offset[i]);
++				bcm47xxpart_add_part(&parts[curr_part++],
++						     name,
++						     offset + trx->offset[i],
++						     0);
++				i++;
++			}
+ 
+ 			last_trx_part = curr_part - 1;
+ 
-- 
1.9.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list