mtd: tests: incorporate error message for mtdtest_read()

All callers of mtdtest_read() print the same error message on failure.
This incorporates the error message to mtdtest_read() and removes them
from the callers.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
This commit is contained in:
Akinobu Mita
2013-08-15 22:55:08 +09:00
committed by David Woodhouse
parent 0d58f6ee01
commit abc173ad84
5 changed files with 17 additions and 76 deletions

View File

@@ -140,14 +140,9 @@ static int write_eraseblock_by_2pages(int ebnum)
static int read_eraseblock(int ebnum)
{
int err;
loff_t addr = ebnum * mtd->erasesize;
err = mtdtest_read(mtd, addr, mtd->erasesize, iobuf);
if (err)
pr_err("error: read failed at %#llx\n", addr);
return err;
return mtdtest_read(mtd, addr, mtd->erasesize, iobuf);
}
static int read_eraseblock_by_page(int ebnum)
@@ -158,11 +153,8 @@ static int read_eraseblock_by_page(int ebnum)
for (i = 0; i < pgcnt; i++) {
err = mtdtest_read(mtd, addr, pgsize, buf);
if (err) {
pr_err("error: read failed at %#llx\n",
addr);
if (err)
break;
}
addr += pgsize;
buf += pgsize;
}
@@ -179,21 +171,13 @@ static int read_eraseblock_by_2pages(int ebnum)
for (i = 0; i < n; i++) {
err = mtdtest_read(mtd, addr, sz, buf);
if (err) {
pr_err("error: read failed at %#llx\n",
addr);
if (err)
return err;
}
addr += sz;
buf += sz;
}
if (pgcnt % 2) {
if (pgcnt % 2)
err = mtdtest_read(mtd, addr, pgsize, buf);
if (err) {
pr_err("error: read failed at %#llx\n",
addr);
}
}
return err;
}