]> git.ipfire.org Git - thirdparty/openwrt.git/commit
kernel: mtdsplit_uimage: return 0 if not fatal 19163/head
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Tue, 17 Jun 2025 09:21:40 +0000 (05:21 -0400)
committerHauke Mehrtens <hauke@hauke-m.de>
Thu, 19 Jun 2025 18:51:18 +0000 (20:51 +0200)
commita51359aafde18b7e809842b4b4c31c78f5fa0c51
tree39dff24a466f82bb1cfb510c8c79cf40152bd4aa
parentf7dba4ebbcebde7e0c5c9186e94a502aeeaf789a
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.

E.g. on Realtek devices that are booted for the first time through
initramfs with OpenWrt never installed before boot log will show

[    0.975518] Creating 7 MTD partitions on "spi0.0":
[    0.981062] 0x000000000000-0x0000000e0000 : "u-boot"
[    1.041320] 0x0000000e0000-0x0000000f0000 : "u-boot-env"
[    1.060683] 0x0000000f0000-0x000000100000 : "u-boot-env2"
[    1.080992] 0x000000100000-0x000000200000 : "jffs2-cfg"
[    1.100988] 0x000000200000-0x000000300000 : "jffs2-log"
[    1.120599] 0x000000300000-0x000000fe0000 : "firmware"
[    1.157426] mtdsplit_uimage: no rootfs after uImage in "firmware"
[    1.176456] mtdsplit_uimage: no rootfs after uImage in "firmware"
[    1.200262] 0x000000fe0000-0x000001000000 : "log"

Similar issues were fixed before with commit ade045084bd3f8696
("kernel: mtdsplit_minor: return 0 if not fatal") and
c78765213ecbe830204 ("kernel: mtdsplit_uimage: return 0 if not fatal")

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/19163
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c