/* Writes wbuffer to page */
static int write_page(int log)
{
- int err;
-
if (log)
pr_info("write_page\n");
- err = mtdtest_write(mtd, offset, mtd->writesize, wbuffer);
- if (err)
- pr_err("error: write failed at %#llx\n", (long long)offset);
-
- return err;
+ return mtdtest_write(mtd, offset, mtd->writesize, wbuffer);
}
/* Re-writes the data area while leaving the OOB alone. */
static int write_eraseblock(int ebnum)
{
- int err;
loff_t addr = ebnum * mtd->erasesize;
prandom_bytes_state(&rnd_state, writebuf, mtd->erasesize);
cond_resched();
- err = mtdtest_write(mtd, addr, mtd->erasesize, writebuf);
- if (err)
- pr_err("error: write failed at %#llx\n",
- (long long)addr);
-
- return err;
+ return mtdtest_write(mtd, addr, mtd->erasesize, writebuf);
}
static int verify_eraseblock(int ebnum)
prandom_bytes_state(&rnd_state, writebuf, pgsize);
strcpy(writebuf, "There is no data like this!");
err = mtdtest_write(mtd, addr0, pgsize, writebuf);
- if (err) {
- pr_info("error: write failed at %#llx\n",
- (long long)addr0);
+ if (err)
return err;
- }
pr_info("reading 1st page of block %d\n", ebnum);
memset(readbuf, 0, pgsize);
prandom_bytes_state(&rnd_state, writebuf, pgsize);
strcpy(writebuf, "There is no data like this!");
err = mtdtest_write(mtd, addr0, pgsize, writebuf);
- if (err) {
- pr_err("error: write failed at %#llx\n",
- (long long)addr0);
+ if (err)
return err;
- }
pr_info("erasing block %d\n", ebnum2);
err = mtdtest_erase_eraseblock(mtd, ebnum2);
pr_info("writing 1st page of block %d\n", ebnum);
prandom_bytes_state(&rnd_state, writebuf, pgsize);
err = mtdtest_write(mtd, addr0, pgsize, writebuf);
- if (err) {
- pr_err("error: write failed at %#llx\n",
- (long long)addr0);
+ if (err)
return err;
- }
pr_info("erasing block %d\n", ebnum);
err = mtdtest_erase_eraseblock(mtd, ebnum);
static int write_eraseblock(int ebnum)
{
- int err;
loff_t addr = ebnum * mtd->erasesize;
- err = mtdtest_write(mtd, addr, mtd->erasesize, iobuf);
- if (err)
- pr_err("error: write failed at %#llx\n", addr);
-
- return err;
+ return mtdtest_write(mtd, addr, mtd->erasesize, iobuf);
}
static int write_eraseblock_by_page(int ebnum)
for (i = 0; i < pgcnt; i++) {
err = mtdtest_write(mtd, addr, pgsize, buf);
- if (err) {
- pr_err("error: write failed at %#llx\n",
- addr);
+ if (err)
break;
- }
addr += pgsize;
buf += pgsize;
}
for (i = 0; i < n; i++) {
err = mtdtest_write(mtd, addr, sz, buf);
- if (err) {
- pr_err("error: write failed at %#llx\n",
- addr);
+ if (err)
return err;
- }
addr += sz;
buf += sz;
}
- if (pgcnt % 2) {
+ if (pgcnt % 2)
err = mtdtest_write(mtd, addr, pgsize, buf);
- if (err) {
- pr_err("error: write failed at %#llx\n",
- addr);
- }
- }
return err;
}