[PATCH] cdev: fix mtd partition handling
Sascha Hauer
s.hauer at pengutronix.de
Tue Aug 5 00:25:37 PDT 2025
devfs-core.c implements the partition handling only for devices that are
not MTD devices. MTD devices have their own partition handling in
drivers/mtd/partition.c, see the special case in __devfs_add_partition()
for MTD devices. This means for MTD devices we have to pass the original
cdev to the ops, not the master cdev.
Fixes: 6d2b6f399c07 ("cdev: pass master cdev to cdev ops")
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
fs/devfs-core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/devfs-core.c b/fs/devfs-core.c
index 52490576b7..9c2dae5545 100644
--- a/fs/devfs-core.c
+++ b/fs/devfs-core.c
@@ -226,6 +226,10 @@ int cdev_find_free_index(const char *basename)
static struct cdev *cdev_get_master(struct cdev *cdev)
{
+ /* mtd devices handle partitions themselves */
+ if (cdev->mtd)
+ return cdev;
+
while (cdev && cdev_is_partition(cdev))
cdev = cdev->master;
--
2.39.5
More information about the barebox
mailing list