mtd: bcm63xxpart: merge sparelen calculation
authorJonas Gorski <jonas.gorski@gmail.com>
Mon, 12 Nov 2012 09:52:48 +0000 (10:52 +0100)
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Wed, 21 Nov 2012 15:15:05 +0000 (17:15 +0200)
The length of the spare part is calculated the same way in both branches
so move to a common place.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Reviewed-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
drivers/mtd/bcm63xxpart.c

index 1eb1416404a6fb67d0143dca03717496576205c2..ba7eeb874b31076a2df13c1b86d9ffce306409f1 100644 (file)
@@ -120,7 +120,6 @@ static int bcm63xx_parse_cfe_partitions(struct mtd_info *master,
                kerneladdr = kerneladdr - BCM63XX_EXTENDED_SIZE;
                rootfsaddr = rootfsaddr - BCM63XX_EXTENDED_SIZE;
                spareaddr = roundup(totallen, master->erasesize) + cfelen;
-               sparelen = master->size - spareaddr - nvramlen;
 
                if (rootfsaddr < kerneladdr) {
                        /* default Broadcom layout */
@@ -138,8 +137,8 @@ static int bcm63xx_parse_cfe_partitions(struct mtd_info *master,
                rootfslen = 0;
                rootfsaddr = 0;
                spareaddr = cfelen;
-               sparelen = master->size - cfelen - nvramlen;
        }
+       sparelen = master->size - spareaddr - nvramlen;
 
        /* Determine number of partitions */
        if (rootfslen > 0)