summaryrefslogtreecommitdiff
path: root/common/cmd_mtdparts.c
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2010-09-09 15:40:03 -0500
committerScott Wood <scottwood@freescale.com>2010-10-11 15:11:01 -0500
commit36650ca9f16ac507bb0926d3a3ec5340986fcce0 (patch)
tree58a54ad1fe45b7f51df8f9a04e640f04a6cf8e47 /common/cmd_mtdparts.c
parent59a50d2de1f9c037166a6f86e6e6cdc1670aa155 (diff)
downloadu-boot-36650ca9f16ac507bb0926d3a3ec5340986fcce0.tar.gz
Followup fixes on the mtdparts spread patchset
Consolidate some code in mtd_get_len_incl_bad(), and fix a condition where a valid partition could be reported as truncated if it has a good block at the end of the device (unlikely, since the BBT is usually there). Fix mid-block declarations in net_part_size(). Signed-off-by: Scott Wood <scottwood@freescale.com> Reviewed-by: Ben Gardiner <bengardiner@nanometrics.ca>
Diffstat (limited to 'common/cmd_mtdparts.c')
-rw-r--r--common/cmd_mtdparts.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c
index 17865b756b..5481c885d3 100644
--- a/common/cmd_mtdparts.c
+++ b/common/cmd_mtdparts.c
@@ -1228,15 +1228,16 @@ static int generate_mtdparts_save(char *buf, u32 buflen)
*/
static uint64_t net_part_size(struct mtd_info *mtd, struct part_info *part)
{
+ uint64_t i, net_size = 0;
+
if (!mtd->block_isbad)
return part->size;
- uint64_t i, net_size = 0;
-
for (i = 0; i < part->size; i += mtd->erasesize) {
if (!mtd->block_isbad(mtd, part->offset + i))
net_size += mtd->erasesize;
}
+
return net_size;
}
#endif