aboutsummaryrefslogtreecommitdiff
path: root/drivers/mtd/ubi/wl.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-06-28 19:16:55 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-07-05 18:47:03 +0300
commit40a71a87fa8e0cb3ec0fca4d152263734b203eb2 (patch)
tree8bdd27304fc4d28c850c76f2b1f4a32c802612f8 /drivers/mtd/ubi/wl.c
parent8e4a718ff38d8539938ec3421935904c27e00c39 (diff)
UBI: add empty eraseblocks verification
This patch adds code which makes sure eraseblocks contain all 0xFF bytes before starting using them. The verification is done only when debugging checks are enabled. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/wl.c')
-rw-r--r--drivers/mtd/ubi/wl.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index 2b247230061..e4be446e05e 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -459,6 +459,14 @@ retry:
dbg_wl("PEB %d EC %d", e->pnum, e->ec);
prot_queue_add(ubi, e);
spin_unlock(&ubi->wl_lock);
+
+ err = ubi_dbg_check_all_ff(ubi, e->pnum, ubi->vid_hdr_aloffset,
+ ubi->peb_size - ubi->vid_hdr_aloffset);
+ if (err) {
+ dbg_err("new PEB does not contain all 0xFF bytes");
+ return err > 0 ? -EINVAL : err;
+ }
+
return e->pnum;
}