[PATCH -next 2/4] mtd: tests: return -EIO when mtdtest_read() failed to read requested bytes

Akinobu Mita akinobu.mita at gmail.com
Thu Aug 15 09:55:07 EDT 2013


mtdtest_read() returns -EINVAL if the number of bytes actually read
is smaller than the number of bytes requested.  But mtdtest_write()
returns -EIO in the similar error condition and returning -EIO seems
more appropriate than -EINVAL in this case.

Signed-off-by: Akinobu Mita <akinobu.mita at gmail.com>
Cc: Brian Norris <computersforpeace at gmail.com>
Cc: Vikram Narayanan <vikram186 at gmail.com>
Cc: Adrian Hunter <adrian.hunter at intel.com>
Cc: Artem Bityutskiy <dedekind1 at gmail.com>
Cc: David Woodhouse <dwmw2 at infradead.org>
Cc: linux-mtd at lists.infradead.org
---
 drivers/mtd/tests/mtd_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/tests/mtd_test.c b/drivers/mtd/tests/mtd_test.c
index 9e63896..bda8c4d 100644
--- a/drivers/mtd/tests/mtd_test.c
+++ b/drivers/mtd/tests/mtd_test.c
@@ -91,7 +91,7 @@ int mtdtest_read(struct mtd_info *mtd, loff_t addr, size_t size, void *buf)
 	if (mtd_is_bitflip(err))
 		err = 0;
 	if (!err && read != size)
-		err = -EINVAL;
+		err = -EIO;
 
 	return err;
 }
-- 
1.8.3.1




More information about the linux-mtd mailing list