summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHolger Brunck <holger.brunck@keymile.com>2011-01-25 13:04:11 +0200
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-01-26 10:13:52 +0200
commitd4c6381303163e774a72db8c172cdc5c23f01588 (patch)
tree2b7a6986c3168b1fc1f17113ac5cc3ef8c320bf1 /drivers
parent3c0eee3fe6a3a1c745379547c7e7c904aa64f6d5 (diff)
downloadop-kernel-dev-d4c6381303163e774a72db8c172cdc5c23f01588.zip
op-kernel-dev-d4c6381303163e774a72db8c172cdc5c23f01588.tar.gz
UBI: fix NOR erase preparation quirk
In 'nor_erase_prepare()' we want to make sure the UBI headers are corrupted. But it is possible that one of the headers just contains all 0xFFs, which is also OK, because UBI will erase it in case of a power cut. Signed-off-by: Holger Brunck <holger.brunck@keymile.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/ubi/io.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
index 811775a..668d240 100644
--- a/drivers/mtd/ubi/io.c
+++ b/drivers/mtd/ubi/io.c
@@ -507,11 +507,13 @@ static int nor_erase_prepare(struct ubi_device *ubi, int pnum)
* PEB.
*/
err1 = ubi_io_read_vid_hdr(ubi, pnum, &vid_hdr, 0);
- if (err1 == UBI_IO_BAD_HDR_EBADMSG || err1 == UBI_IO_BAD_HDR) {
+ if (err1 == UBI_IO_BAD_HDR_EBADMSG || err1 == UBI_IO_BAD_HDR ||
+ err1 == UBI_IO_FF) {
struct ubi_ec_hdr ec_hdr;
err1 = ubi_io_read_ec_hdr(ubi, pnum, &ec_hdr, 0);
- if (err1 == UBI_IO_BAD_HDR_EBADMSG || err1 == UBI_IO_BAD_HDR)
+ if (err1 == UBI_IO_BAD_HDR_EBADMSG || err1 == UBI_IO_BAD_HDR ||
+ err1 == UBI_IO_FF)
/*
* Both VID and EC headers are corrupted, so we can
* safely erase this PEB and not afraid that it will be
OpenPOWER on IntegriCloud