[PATCH v2 3/3] mtd: nand: omap2: Support for hardware BCH error correction

Artem Bityutskiy artem.bityutskiy at linux.intel.com
Fri Nov 30 07:28:00 EST 2012


On Wed, 2012-10-31 at 12:38 +0530, Philip, Avinash wrote:
> +static int erased_sector_bitflips(u_char *data, u_char *oob,
> +               struct omap_nand_info *info)
> +{
> +       int flip_bits = 0, i;
> +
> +       for (i = 0; i < info->nand.ecc.size; i++) {
> +               flip_bits += hweight8(~data[i]);
> +               if (flip_bits > info->nand.ecc.strength)
> +                       return 0;
> +       }
> +
> +       for (i = 0; i < info->nand.ecc.bytes - 1; i++) {
> +               flip_bits += hweight8(~oob[i]);
> +               if (flip_bits > info->nand.ecc.strength)
> +                       return 0;
> +       }

Why do you need the second for loop?

-- 
Best Regards,
Artem Bityutskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20121130/5b3a5667/attachment.sig>


More information about the linux-mtd mailing list