]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
mtd: bcm47xxpart: only register partitions if the trx header was filled
authorHauke Mehrtens <hauke@hauke-m.de>
Sun, 21 Sep 2014 22:33:13 +0000 (00:33 +0200)
committerBrian Norris <computersforpeace@gmail.com>
Wed, 22 Oct 2014 09:04:34 +0000 (02:04 -0700)
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>
drivers/mtd/bcm47xxpart.c

index f2db4d7d6c360b31a925f22f521dcbe2610a89e5..cc13ea5ce4d58f6cb532d151d5f22d9aa46e8c2c 100644 (file)
@@ -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;