[PATCH] cdev: fix mtd partition handling
Stefano Manni
stefano.manni at gmail.com
Tue Aug 5 06:14:56 PDT 2025
On mar, ago 5 2025 at 09:25:37 +02:00:00, Sascha Hauer
<s.hauer at pengutronix.de> wrote:
> 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
>
Tested-by: Stefano Manni <stefano.manni at gmail.com>
More information about the barebox
mailing list