kernel: mtdsplit_minor: return 0 if not fatal
authorJohn Thomson <git@johnthomson.fastmail.com.au>
Tue, 15 Oct 2024 21:13:25 +0000 (07:13 +1000)
committerRobert Marko <robimarko@gmail.com>
Wed, 30 Oct 2024 10:15:34 +0000 (11:15 +0100)
commitade045084bd3f86969eaf0b35234aaa01e430fe1
tree6b101adfc3bcbe797fb19cad7a1f75e9f1967a51
parenta6a44f94bf8ccae8c7843ac3db2d606b961976c2
kernel: mtdsplit_minor: 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 MiNOR mtdsplit 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.

This mtdsplit parser makes a very limited check of the first YAFFS
header. For example, this will not match expectations when initially booting
an initramfs image with OEM on MTD.

Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
Acked-by: Thibaut VARENE <hacks@slashdirt.org>
Link: https://github.com/openwrt/openwrt/pull/16780
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_minor.c