[PATCH] mtd: cmdlinepart: fix the wrong partitions number when truncating occurs
Huang Shijie
shijie8 at gmail.com
Sat Aug 18 12:51:02 EDT 2012
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.
Signed-off-by: Huang Shijie <shijie8 at gmail.com>
---
drivers/mtd/cmdlinepart.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/mtd/cmdlinepart.c b/drivers/mtd/cmdlinepart.c
index 4558e0f..fc960a3 100644
--- a/drivers/mtd/cmdlinepart.c
+++ b/drivers/mtd/cmdlinepart.c
@@ -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;
}
--
1.7.4.4
More information about the linux-mtd
mailing list