[PATCH 02/11] cmd: ubi: report a failed UBI block device bind
Daniel Golle
daniel at makrotopia.org
Mon Sep 28 17:04:54 PDT 2026
ubi_blk_bind_once() drops the ubi_bind() return value, so when the bind
fails the attach still reports success and the caller finds no ubi_blk
device with nothing to explain it.
Report the errno. The attach itself is not failed: UBI is available
either way and the block device is an optional view of it, so a UBIFS
user must not lose the partition because the block layer could not be
set up.
Fixes: dec405d1653a ("cmd: ubi: create a ubi_blk device when attaching UBI")
Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
cmd/ubi.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/cmd/ubi.c b/cmd/ubi.c
index 91ba21504f4..7cbb3ee8668 100644
--- a/cmd/ubi.c
+++ b/cmd/ubi.c
@@ -676,7 +676,9 @@ int ubi_detach(void)
#if CONFIG_IS_ENABLED(UBI_BLOCK)
static void ubi_blk_bind_once(void)
{
+ struct udevice *parent;
struct udevice *dev;
+ int ret;
/*
* A single ubi_blk device serves all volumes of the attached UBI
@@ -690,7 +692,11 @@ static void ubi_blk_bind_once(void)
return;
}
- ubi_bind(ubi && ubi->mtd && ubi->mtd->dev ? ubi->mtd->dev : dm_root());
+ parent = ubi && ubi->mtd && ubi->mtd->dev ? ubi->mtd->dev : dm_root();
+
+ ret = ubi_bind(parent);
+ if (ret)
+ printf("Cannot create UBI block device: %d\n", ret);
}
#else
static inline void ubi_blk_bind_once(void) { }
--
2.55.0
More information about the openwrt-devel
mailing list