aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/erase.c
diff options
context:
space:
mode:
authorAnders Grafström <grfstrm@users.sourceforge.net>2008-03-12 15:29:23 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2008-04-23 05:06:46 -0400
commit8a0f572397ca0673c65c1662946014bb73b5cdc6 (patch)
tree52826a59a08401e1e0fa34734667391e5d28b775 /fs/jffs2/erase.c
parente43fe686e48835ca027559a068bbe0b6d264a254 (diff)
[JFFS2] Return values of jffs2_block_check_erase error paths
It looks the error paths in jffs2_block_check_erase() have wrong return values. A block that failed to be erased never gets marked as bad. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs/jffs2/erase.c')
-rw-r--r--fs/jffs2/erase.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c
index 65d91943fc2d..5e2719cb6930 100644
--- a/fs/jffs2/erase.c
+++ b/fs/jffs2/erase.c
@@ -350,9 +350,11 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl
350 break; 350 break;
351 } while(--retlen); 351 } while(--retlen);
352 c->mtd->unpoint(c->mtd, ebuf, jeb->offset, c->sector_size); 352 c->mtd->unpoint(c->mtd, ebuf, jeb->offset, c->sector_size);
353 if (retlen) 353 if (retlen) {
354 printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08tx\n", 354 printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08tx\n",
355 *wordebuf, jeb->offset + c->sector_size-retlen*sizeof(*wordebuf)); 355 *wordebuf, jeb->offset + c->sector_size-retlen*sizeof(*wordebuf));
356 return -EIO;
357 }
356 return 0; 358 return 0;
357 } 359 }
358 do_flash_read: 360 do_flash_read:
@@ -373,10 +375,12 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl
373 ret = c->mtd->read(c->mtd, ofs, readlen, &retlen, ebuf); 375 ret = c->mtd->read(c->mtd, ofs, readlen, &retlen, ebuf);
374 if (ret) { 376 if (ret) {
375 printk(KERN_WARNING "Read of newly-erased block at 0x%08x failed: %d. Putting on bad_list\n", ofs, ret); 377 printk(KERN_WARNING "Read of newly-erased block at 0x%08x failed: %d. Putting on bad_list\n", ofs, ret);
378 ret = -EIO;
376 goto fail; 379 goto fail;
377 } 380 }
378 if (retlen != readlen) { 381 if (retlen != readlen) {
379 printk(KERN_WARNING "Short read from newly-erased block at 0x%08x. Wanted %d, got %zd\n", ofs, readlen, retlen); 382 printk(KERN_WARNING "Short read from newly-erased block at 0x%08x. Wanted %d, got %zd\n", ofs, readlen, retlen);
383 ret = -EIO;
380 goto fail; 384 goto fail;
381 } 385 }
382 for (i=0; i<readlen; i += sizeof(unsigned long)) { 386 for (i=0; i<readlen; i += sizeof(unsigned long)) {
@@ -385,6 +389,7 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl
385 if (*datum + 1) { 389 if (*datum + 1) {
386 *bad_offset += i; 390 *bad_offset += i;
387 printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08x\n", *datum, *bad_offset); 391 printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08x\n", *datum, *bad_offset);
392 ret = -EIO;
388 goto fail; 393 goto fail;
389 } 394 }
390 } 395 }