diff mbox

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

Message ID 1376574909-7507-3-git-send-email-akinobu.mita@gmail.com
State New, archived
Headers show

Commit Message

Akinobu Mita Aug. 15, 2013, 1:55 p.m. UTC
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@gmail.com>
Cc: Brian Norris <computersforpeace@gmail.com>
Cc: Vikram Narayanan <vikram186@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Artem Bityutskiy <dedekind1@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: linux-mtd@lists.infradead.org
---
 drivers/mtd/tests/mtd_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

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;
 }