On Mon, 30 Aug 2010 13:38:59 -0400 Ben Gardiner <bengardi...@nanometrics.ca> wrote:
> +static void spread_partition(struct mtd_info *mtd, struct part_info *part, > + uint64_t *next_offset) > +{ > + uint64_t net_size, padding_size = 0; > + int truncated; > + > + mtd_get_len_incl_bad(mtd, part->offset, part->size, &net_size, > + &truncated); > + > + /* > + * Absorb bad blocks immediately following this > + * partition also into the partition, such that > + * the next partition starts with a good block. > + */ Why is the first block of a partition special? > + if (!truncated) { > + mtd_get_len_incl_bad(mtd, part->offset + net_size, > + mtd->erasesize, &padding_size, &truncated); > + padding_size -= mtd->erasesize; What if this is the last partition? You're relying on an implementation quick (bug?) that mtd_get_len_incl_bad() will let you exceed the device size by a block if you start there. If it returned the more expected zero in such a case, you'll end up subtracting a block from net_size. > + } > + > + if (truncated) { } else { -Scott _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot