Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 68446
b: refs/heads/master
c: fab2c39
h: refs/heads/master
v: v3
  • Loading branch information
Joakim Tjernlund authored and David Woodhouse committed Jun 28, 2007
1 parent 21009d4 commit cff83a0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7eafaed55f4b8599cfe55449a6ed88d3693954de
refs/heads/master: fab2c399129273713b7dcc6a54cef17ca124a47f
27 changes: 27 additions & 0 deletions trunk/fs/jffs2/erase.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,33 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl
size_t retlen;
int ret = -EIO;

if (c->mtd->point) {
unsigned long *wordebuf;

ret = c->mtd->point(c->mtd, jeb->offset, c->sector_size, &retlen, (unsigned char **)&ebuf);
if (ret) {
D1(printk(KERN_DEBUG "MTD point failed %d\n", ret));
goto do_flash_read;
}
if (retlen < c->sector_size) {
/* Don't muck about if it won't let us point to the whole erase sector */
D1(printk(KERN_DEBUG "MTD point returned len too short: 0x%zx\n", retlen));
c->mtd->unpoint(c->mtd, ebuf, jeb->offset, c->sector_size);
goto do_flash_read;
}
wordebuf = ebuf-sizeof(*wordebuf);
retlen /= sizeof(*wordebuf);
do {
if (*++wordebuf != ~0)
break;
} while(--retlen);
c->mtd->unpoint(c->mtd, ebuf, jeb->offset, c->sector_size);
if (retlen)
printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08x\n",
*wordebuf, jeb->offset + c->sector_size-retlen*sizeof(*wordebuf));
return 0;
}
do_flash_read:
ebuf = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!ebuf) {
printk(KERN_WARNING "Failed to allocate page buffer for verifying erase at 0x%08x. Refiling\n", jeb->offset);
Expand Down

0 comments on commit cff83a0

Please sign in to comment.