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 <markus.stockhausen@gmx.de>
This commit is contained in:
Markus Stockhausen 2025-06-04 03:19:40 -04:00
parent 264661a704
commit 4345acfd4f

View File

@ -186,8 +186,8 @@ static int __mtdsplit_parse_uimage(struct mtd_info *master,
} }
if (uimage_size == 0) { if (uimage_size == 0) {
pr_debug("no uImage found in \"%s\"\n", master->name); pr_info("no uImage found in \"%s\"\n", master->name);
ret = -ENODEV; ret = 0;
goto err_free_buf; 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, ret = mtd_find_rootfs_from(master, uimage_offset + uimage_size,
master->size, &rootfs_offset, &type); master->size, &rootfs_offset, &type);
if (ret) { if (ret) {
pr_debug("no rootfs after uImage in \"%s\"\n", pr_info("no rootfs after uImage in \"%s\"\n", master->name);
master->name); ret = 0;
goto err_free_buf; goto err_free_buf;
} }
@ -215,8 +215,8 @@ static int __mtdsplit_parse_uimage(struct mtd_info *master,
/* check rootfs presence at offset 0 */ /* check rootfs presence at offset 0 */
ret = mtd_check_rootfs_magic(master, 0, &type); ret = mtd_check_rootfs_magic(master, 0, &type);
if (ret) { if (ret) {
pr_debug("no rootfs before uImage in \"%s\"\n", pr_info("no rootfs before uImage in \"%s\"\n", master->name);
master->name); ret = 0;
goto err_free_buf; goto err_free_buf;
} }