Skip to contentSkip to conversation

mtd: cmdlinepart: fix the wrong partitions number when truncating occurs

PATCH Superseded Huang Shijie 2 participants 3 messages Aug 18, 2012 – Aug 24, 2012 Memory technology devices (MTD)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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
index 4558e0f..fc960a3 100644
@@ -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
#1 lore raw
Quoted 5 lines · Huang Shijie
drivers/mtd/cmdlinepart.c +0 -0
index 4558e0f..fc960a3 100644

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
#2 lore raw
Quoted 10 lines · Artem Bityutskiy
Quoted 9 lines · Huang Shijie
drivers/mtd/cmdlinepart.c +0 -1
index 4558e0f..fc960a3 100644
@@ -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