summaryrefslogtreecommitdiff
path: root/drivers/mtd/ubi/build.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2023-10-09 18:09:23 +0200
committerIngo Molnar <mingo@kernel.org>2023-10-09 18:09:23 +0200
commitfdb8b7a1af31d69ee1c8ddc02926cb409eaaecc3 (patch)
tree9af7010f5f93005adbf6f98c6557552b86d32697 /drivers/mtd/ubi/build.c
parent0cff993e08a7578e2c1df93a95fc5059f447e7ae (diff)
parent94f6f0550c625fab1f373bb86a6669b45e9748b3 (diff)
Merge tag 'v6.6-rc5' into locking/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/mtd/ubi/build.c')
-rw-r--r--drivers/mtd/ubi/build.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 8b91a55ec0d2..8ee51e49fced 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -894,6 +894,13 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
return -EINVAL;
}
+ /* UBI cannot work on flashes with zero erasesize. */
+ if (!mtd->erasesize) {
+ pr_err("ubi: refuse attaching mtd%d - zero erasesize flash is not supported\n",
+ mtd->index);
+ return -EINVAL;
+ }
+
if (ubi_num == UBI_DEV_NUM_AUTO) {
/* Search for an empty slot in the @ubi_devices array */
for (ubi_num = 0; ubi_num < UBI_MAX_DEVICES; ubi_num++)