From 4345acfd4f716cdbe9afcaedeb3b64e7ac8fe184 Mon Sep 17 00:00:00 2001 From: Markus Stockhausen Date: Wed, 4 Jun 2025 03:19:40 -0400 Subject: [PATCH] kernel: mtdsplit_uimage: return 0 if not fatal Introduced with Linux 6.7, in commit: 5c2f7727d437 ("mtd: mtdpart: check for subpartitions parsing result"), when a parser returns an error, this will be passed up, and consequently, all parent mtd partitions get torn down. Adjust the mtdsplit_uimage driver to only return an error if there is a critical problem in reading from the mtd device or allocating memory. Otherwise return 0 to indicate that no partitions were found. Also add logging to indicate what went wrong. Signed-off-by: Markus Stockhausen --- .../files/drivers/mtd/mtdsplit/mtdsplit_uimage.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c index a3e55fb1f..0d9685490 100644 --- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c +++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c @@ -186,8 +186,8 @@ static int __mtdsplit_parse_uimage(struct mtd_info *master, } if (uimage_size == 0) { - pr_debug("no uImage found in \"%s\"\n", master->name); - ret = -ENODEV; + pr_info("no uImage found in \"%s\"\n", master->name); + ret = 0; goto err_free_buf; } @@ -201,8 +201,8 @@ static int __mtdsplit_parse_uimage(struct mtd_info *master, ret = mtd_find_rootfs_from(master, uimage_offset + uimage_size, master->size, &rootfs_offset, &type); if (ret) { - pr_debug("no rootfs after uImage in \"%s\"\n", - master->name); + pr_info("no rootfs after uImage in \"%s\"\n", master->name); + ret = 0; goto err_free_buf; } @@ -215,8 +215,8 @@ static int __mtdsplit_parse_uimage(struct mtd_info *master, /* check rootfs presence at offset 0 */ ret = mtd_check_rootfs_magic(master, 0, &type); if (ret) { - pr_debug("no rootfs before uImage in \"%s\"\n", - master->name); + pr_info("no rootfs before uImage in \"%s\"\n", master->name); + ret = 0; goto err_free_buf; }