kernel: add missing config symbol
[15.05/openwrt.git] / target / linux / generic / patches-3.18 / 040-mtd-bcm47xxpart-backports-from-3.19.patch
1 --- a/drivers/mtd/bcm47xxpart.c
2 +++ b/drivers/mtd/bcm47xxpart.c
3 @@ -15,8 +15,12 @@
4  #include <linux/mtd/mtd.h>
5  #include <linux/mtd/partitions.h>
6  
7 -/* 10 parts were found on sflash on Netgear WNDR4500 */
8 -#define BCM47XXPART_MAX_PARTS          12
9 +/*
10 + * NAND flash on Netgear R6250 was verified to contain 15 partitions.
11 + * This will result in allocating too big array for some old devices, but the
12 + * memory will be freed soon anyway (see mtd_device_parse_register).
13 + */
14 +#define BCM47XXPART_MAX_PARTS          20
15  
16  /*
17   * Amount of bytes we read when analyzing each block of flash memory.
18 @@ -168,18 +172,26 @@ static int bcm47xxpart_parse(struct mtd_
19                                 i++;
20                         }
21  
22 -                       bcm47xxpart_add_part(&parts[curr_part++], "linux",
23 -                                            offset + trx->offset[i], 0);
24 -                       i++;
25 +                       if (trx->offset[i]) {
26 +                               bcm47xxpart_add_part(&parts[curr_part++],
27 +                                                    "linux",
28 +                                                    offset + trx->offset[i],
29 +                                                    0);
30 +                               i++;
31 +                       }
32  
33                         /*
34                          * Pure rootfs size is known and can be calculated as:
35                          * trx->length - trx->offset[i]. We don't fill it as
36                          * we want to have jffs2 (overlay) in the same mtd.
37                          */
38 -                       bcm47xxpart_add_part(&parts[curr_part++], "rootfs",
39 -                                            offset + trx->offset[i], 0);
40 -                       i++;
41 +                       if (trx->offset[i]) {
42 +                               bcm47xxpart_add_part(&parts[curr_part++],
43 +                                                    "rootfs",
44 +                                                    offset + trx->offset[i],
45 +                                                    0);
46 +                               i++;
47 +                       }
48  
49                         last_trx_part = curr_part - 1;
50