1 --- a/drivers/mtd/bcm47xxpart.c
2 +++ b/drivers/mtd/bcm47xxpart.c
4 #define ML_MAGIC2 0x26594131
5 #define TRX_MAGIC 0x30524448
6 #define SQSH_MAGIC 0x71736873 /* shsq */
7 +#define UBI_EC_MAGIC 0x23494255 /* UBI# */
11 @@ -50,7 +51,7 @@ struct trx_header {
15 -static void bcm47xxpart_add_part(struct mtd_partition *part, char *name,
16 +static void bcm47xxpart_add_part(struct mtd_partition *part, const char *name,
17 u64 offset, uint32_t mask_flags)
20 @@ -58,6 +59,26 @@ static void bcm47xxpart_add_part(struct
21 part->mask_flags = mask_flags;
24 +static const char *bcm47xxpart_trx_data_part_name(struct mtd_info *master,
30 + if (mtd_read(master, offset, sizeof(&buf), &bytes_read,
31 + (uint8_t *)&buf) < 0) {
32 + pr_err("mtd_read error while parsing (offset: 0x%X)!\n",
37 + if (buf == UBI_EC_MAGIC)
44 static int bcm47xxpart_parse(struct mtd_info *master,
45 struct mtd_partition **pparts,
46 struct mtd_part_parser_data *data)
47 @@ -151,6 +172,8 @@ static int bcm47xxpart_parse(struct mtd_
50 if (buf[0x000 / 4] == TRX_MAGIC) {
53 if (BCM47XXPART_MAX_PARTS - curr_part < 4) {
54 pr_warn("Not enough partitions left to register trx, scanning stopped!\n");
56 @@ -186,8 +209,9 @@ static int bcm47xxpart_parse(struct mtd_
57 * we want to have jffs2 (overlay) in the same mtd.
60 + name = bcm47xxpart_trx_data_part_name(master, offset + trx->offset[i]);
61 bcm47xxpart_add_part(&parts[curr_part++],
64 offset + trx->offset[i],