mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] mtd: do not attach already attached UBI
@ 2018-10-08  9:15 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2018-10-08  9:15 UTC (permalink / raw)
  To: Barebox List

in mtd_detect we do not check if the mtd is already attached to UBI. If
it is we get the error:

ERROR: ubi: mtd0 is already attached to ubi0

Check before trying to attach it to avoid this message.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mtd/core.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c
index ae7818a189..15fe9ce798 100644
--- a/drivers/mtd/core.c
+++ b/drivers/mtd/core.c
@@ -589,11 +589,8 @@ static int mtd_detect(struct device_d *dev)
 			continue;
 
 		filetype = file_detect_type(buf, bufsize);
-		if (filetype == filetype_ubi) {
+		if (filetype == filetype_ubi && ubi_num_get_by_mtd(mtd) < 0)
 			ret = ubi_attach_mtd_dev(mtd, UBI_DEV_NUM_AUTO, 0, 20);
-			if (ret == -EEXIST)
-				ret = 0;
-		}
 
 		break;
 	}
-- 
2.19.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-10-08  9:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-08  9:15 [PATCH] mtd: do not attach already attached UBI Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox