openwrt-mirror/target/linux/generic/files/drivers/mtd/mtdsplit
Markus Stockhausen a51359aafd 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 ade045084b
("kernel: mtdsplit_minor: return 0 if not fatal") and
c78765213e ("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>
2025-06-19 20:51:18 +02:00
..
Kconfig kernel: add seil-fw mtdsplit driver for IIJ SEIL devices 2023-10-31 14:02:01 +01:00
Makefile kernel: add seil-fw mtdsplit driver for IIJ SEIL devices 2023-10-31 14:02:01 +01:00
mtdsplit_bcm63xx.c kernel: mtdsplit: add support for BCM63XX CFE firmware 2021-02-22 18:09:03 +01:00
mtdsplit_bcm_wfi.c kernel: mtd: bcm-wfi: add cferam name support 2023-06-14 23:21:34 +02:00
mtdsplit_brnimage.c
mtdsplit_cfe_bootfs.c kernel: create bootfs partition when parsing on BCM4908 2021-03-24 18:22:37 +01:00
mtdsplit_elf.c kernel: mtdsplit: support ELF loader splitting 2020-09-09 20:41:50 +03:00
mtdsplit_eva.c
mtdsplit_fit.c kernel: mtdsplit: fix fit rootfs_data split 2024-07-07 20:58:56 +08:00
mtdsplit_h3c_vfs.c kernel: mtdsplit: add support for H3C VFS filesystem 2022-07-28 14:08:56 +02:00
mtdsplit_jimage.c treewide: strip trailing whitespace 2025-05-20 00:47:37 +02:00
mtdsplit_lzma.c generic: mtdsplit: include appropriate header for kernel 6.12 2025-04-30 16:26:46 +02:00
mtdsplit_minor.c kernel: mtdsplit_minor: accept bootimage filename 2024-10-30 11:15:34 +01:00
mtdsplit_seama.c
mtdsplit_seil.c kernel: add seil-fw mtdsplit driver for IIJ SEIL devices 2023-10-31 14:02:01 +01:00
mtdsplit_squashfs.c kernel: rename mtdpart_get_master to mtd_get_master 2020-11-13 13:16:51 +01:00
mtdsplit_tplink.c
mtdsplit_trx.c
mtdsplit_uimage.c kernel: mtdsplit_uimage: return 0 if not fatal 2025-06-19 20:51:18 +02:00
mtdsplit_wrgg.c
mtdsplit.c
mtdsplit.h