summaryrefslogtreecommitdiff
path: root/drivers/mtd/ubi/io.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2021-02-23 13:33:13 +0300
committerJiri Kosina <jkosina@suse.cz>2021-02-23 13:33:13 +0300
commitd6310078d9f8c416e85f641a631aecf58f9c97ff (patch)
tree58ed5d9818ada3e970d93438083731abd6293ba9 /drivers/mtd/ubi/io.c
parentf8dd50e097b221e35c34b844826db92158ec18c2 (diff)
parentdf7b622906f24be954beca94e60c195fde65c6d5 (diff)
downloadlinux-d6310078d9f8c416e85f641a631aecf58f9c97ff.tar.xz
Merge branch 'for-5.12/google' into for-linus
- User experience improvements for hid-google from Nicolas Boichat
Diffstat (limited to 'drivers/mtd/ubi/io.c')
-rw-r--r--drivers/mtd/ubi/io.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
index 14d890b00d2c..2f3312c31e51 100644
--- a/drivers/mtd/ubi/io.c
+++ b/drivers/mtd/ubi/io.c
@@ -535,7 +535,14 @@ int ubi_io_sync_erase(struct ubi_device *ubi, int pnum, int torture)
return -EROFS;
}
- if (ubi->nor_flash) {
+ /*
+ * If the flash is ECC-ed then we have to erase the ECC block before we
+ * can write to it. But the write is in preparation to an erase in the
+ * first place. This means we cannot zero out EC and VID before the
+ * erase and we just have to hope the flash starts erasing from the
+ * start of the page.
+ */
+ if (ubi->nor_flash && ubi->mtd->writesize == 1) {
err = nor_erase_prepare(ubi, pnum);
if (err)
return err;