[U-Boot] [PATCH] nand: fixed failed reads on corrected ECC errors in nand_util.c
Valeriy Glushkov
gvv at lstec.com
Fri Jul 17 10:11:53 CEST 2009
Hi Scott,
>> if (len_incl_bad == *length) {
>> rval = nand_read (nand, offset, length, buffer);
>> - if (rval != 0)
>> - printf ("NAND read from offset %llx failed %d\n",
>> - offset, rval);
>> -
>> + if (!rval || rval == -EUCLEAN)
>> + return 0;
>> + printf ("NAND read from offset %llx failed %d\n",
>> + offset, rval);
>
> Out of curiosity, why invert the logic from if (error) print; return to if
> (!error) return; print; return?
Because it looks a bit better for me than 2 other versions.
And saves a line. :)
-------
if (!rval || rval == -EUCLEAN)
return 0;
printf ("NAND read from offset %llx failed %d\n",
offset, rval);
return rval;
--------
if (rval && rval != -EUCLEAN) {
printf ("NAND read from offset %llx failed %d\n",
offset, rval);
return rval;
}
return 0;
-------
if (rval && rval != -EUCLEAN)
printf ("NAND read from offset %llx failed %d\n",
offset, rval);
else
rval = 0;
return rval;
--------
Best regards,
Valeriy Glushkov
More information about the U-Boot
mailing list