[PATCH] MTD: treat any negative return value from correct() as an error
joern at logfs.org
Sat Oct 20 06:42:26 EDT 2007
On Wed, 17 October 2007 14:33:23 -0700, mattjreimer at gmail.com wrote:
> Treat any negative return value from a NAND driver's correct() function
> as a failure, rather than just -1. Some drivers (e.g. diskonchip) can
> return error values such as -EIO, which ended up being treated as the
> number of bits corrected, which in turn resulted in nand_do_read_ops()
> returning -EUCLEAN rather than -EBADMSG.
What an interesting patch.
NACK on patch description. Several things are wrong with this:
o -EIO shouldn't become -EBADMSG any more than -EUCLEAN. It should
remain -EIO and nothing else.
o I cannot see how diskonchip can return -EIO. Only -ERANGE.
o rtc_from4_correct_data() and doc200x_correct_data() will basically
pass on -ERANGE from decode_rs8() or decode_rs16(), respectively.
Afaict decode_rsXX() should just BUG() instead.
However I like the patch itself, because it allows one to rename those
magic -1 return values to self-documenting -EBADMSG.
It is the mark of an educated mind to be able to entertain a thought
without accepting it.
More information about the linux-mtd