1 --- a/drivers/mtd/bcm47xxpart.c
2 +++ b/drivers/mtd/bcm47xxpart.c
3 @@ -61,6 +61,8 @@ static int bcm47xxpart_parse(struct mtd_
5 uint32_t blocksize = 0x10000;
6 struct trx_header *trx;
8 + int last_trx_part = -1;
11 parts = kzalloc(sizeof(struct mtd_partition) * BCM47XXPART_MAX_PARTS,
12 @@ -131,6 +133,10 @@ static int bcm47xxpart_parse(struct mtd_
13 if (buf[0x000 / 4] == TRX_MAGIC) {
14 trx = (struct trx_header *)buf;
16 + trx_part = curr_part;
17 + bcm47xxpart_add_part(&parts[curr_part++], "firmware",
21 /* We have LZMA loader if offset[2] points to sth */
23 @@ -154,6 +160,8 @@ static int bcm47xxpart_parse(struct mtd_
24 offset + trx->offset[i], 0);
27 + last_trx_part = curr_part - 1;
30 * We have whole TRX scanned, skip to the next part. Use
31 * roundown (not roundup), as the loop will increase
32 @@ -174,6 +182,9 @@ static int bcm47xxpart_parse(struct mtd_
33 parts[i + 1].offset : master->size;
35 parts[i].size = next_part_offset - parts[i].offset;
36 + if (i == last_trx_part && trx_part >= 0)
37 + parts[trx_part].size = next_part_offset -
38 + parts[trx_part].offset;