summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/build.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2020-05-14 07:11:17 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-05-14 07:11:17 +0200
commit45000aac11315d7ccbaeefa29cafc8303ac206cb (patch)
tree0bddc2c0cb20514ee080062899020d1ee4d7bb12 /drivers/mtd/ubi/build.c
parent36acabd5c522501bd7da8eb7a21c865fc78676ee (diff)
parent7721719313bc47e0eb90d45c00d67233d698bd2f (diff)
downloadbarebox-45000aac11315d7ccbaeefa29cafc8303ac206cb.tar.gz
barebox-45000aac11315d7ccbaeefa29cafc8303ac206cb.tar.xz
Merge branch 'for-next/misc'
Diffstat (limited to 'drivers/mtd/ubi/build.c')
-rw-r--r--drivers/mtd/ubi/build.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 604fe87e53..da409010f7 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -508,6 +508,14 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
struct ubi_device *ubi;
int i, err, ref = 0;
+ /*
+ * Do not try to attach an UBI device if this device has partitions
+ * as it's not a good idea to attach UBI on a raw device when the
+ * real UBI only spans the first partition.
+ */
+ if (!list_empty(&mtd->partitions))
+ return -EBUSY;
+
if (max_beb_per1024 < 0 || max_beb_per1024 > MAX_MTD_UBI_BEB_LIMIT)
return -EINVAL;