mtd: cmdlinepart: fix the wrong partitions number when truncating occurs
PATCH 1/1 mtd: cmdlinepart: fix the wrong partitions number when truncating occurs
When the partition truncating occurs, the old code misses the truncated partition. So the partitions number is not right.
This patch fixes it. Alao add a break to shortcut the code in this case.
--- drivers/mtd/cmdlinepart.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/mtd/cmdlinepart.c +2 -1
@@ -344,7 +344,8 @@ static int parse_cmdline_partitions(struct mtd_info *master,"%s: partitioning exceeds flash size, truncating\n" , part->mtd_id); part->parts[i].size = master->size - offset; - part->num_parts = i; + part->num_parts = i +1 ; +break ; } offset += part->parts[i].size; }
Signature · 1 line
1.7.4.4
Quoted 5 lines · Huang Shijie
drivers/mtd/cmdlinepart.c +0
-0
drivers/mtd/cmdlinepart.c static int parse_cmdline_partitions(struct mtd_info *master, · line 351
Quoted 9 lines
drivers/mtd/cmdlinepart.c +2
-1@@ -344,7 +344,8 @@ static int parse_cmdline_partitions(struct mtd_info *master,"%s: partitioning exceeds flash size, truncating\n" , part->mtd_id); part->parts[i].size = master->size - offset; - part->num_parts = i; + part->num_parts = i +1 ; +break ; } offset += part->parts[i].size; }
I do not understand this change. Could you explain some more which problem you solve and how?
Signature · 2 lines
Best Regards, Artem Bityutskiy
Quoted 10 lines · Artem Bityutskiy
Quoted 9 lines · Huang Shijie
drivers/mtd/cmdlinepart.c +0
-1@@ -344,7 +344,8 @@ static int parse_cmdline_partitions(struct mtd_info *master,"%s: partitioning exceeds flash size, truncating\n" , part->mtd_id); part->parts[i].size = master->size - offset; - part->num_parts = i;
Quoted 8 lines
drivers/mtd/cmdlinepart.c static int parse_cmdline_partitions(struct mtd_info *master, · line 351
Quoted 5 lines
drivers/mtd/cmdlinepart.c +2
-0+ part->num_parts = i +1 ; +break ; } offset += part->parts[i].size; }I do not understand this change. Could you explain some more which problem you solve and how?
ok.
I will explain more in the next version as well as another patch.
thanks
Huang Shijie
Quoted 4 lines
--
Best Regards,
Artem Bityutskiy