summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorHou Tao <houtao1@huawei.com>2020-02-10 21:26:35 +0800
committerRichard Weinberger <richard@nod.at>2020-03-30 23:02:36 +0200
commit294a8dbe34d3b2f6e48eb9058ed21d7fe9348b6b (patch)
tree0d3acda683d6039fa6d04ee88752b325d091ebe4 /drivers/mtd
parentc16f39d14a7e0ec59881fbdb22ae494907534384 (diff)
downloadlinux-294a8dbe34d3b2f6e48eb9058ed21d7fe9348b6b.tar.bz2
ubi: fastmap: Only produce the initial anchor PEB when fastmap is used
Don't produce the initial anchor PEB when ubi device is read-only or fastmap is disabled, else the resulting PEB will be unusable to any volume. Signed-off-by: Hou Tao <houtao1@huawei.com> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/ubi/wl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index 837d690a8c60..5146cce5fe32 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -1875,7 +1875,8 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
goto out_free;
#ifdef CONFIG_MTD_UBI_FASTMAP
- ubi_ensure_anchor_pebs(ubi);
+ if (!ubi->ro_mode && !ubi->fm_disabled)
+ ubi_ensure_anchor_pebs(ubi);
#endif
return 0;