Rework each affected mtdsplit driver to make use of -ENOENT error
instead of -ENODEV to handle new kernel that checks error from parser on
subpartitions.
The only acceptable error is -ENOENT that skip the parser. This follow
pattern used upstream and also by an mtdsplit parser, mtdsplit_bcm_wfi,
and also by a workaround currently implemented for mtdsplit_mstc_boot.
Signed-off-by: Christian Marangi <[email protected]>
retlen = le64_to_cpu(sb.bytes_used);
if (retlen <= 0) {
pr_alert("squashfs is empty in \"%s\"\n", master->name);
- return -ENODEV;
+ return -ENOENT;
}
if (offset + retlen > master->size) {
return 0;
}
- return -ENODEV;
+ return -ENOENT;
}
EXPORT_SYMBOL_GPL(mtd_find_rootfs_from);
size_t offset,
size_t *squashfs_len)
{
- return -ENODEV;
+ return -ENOENT;
}
static inline int mtd_check_rootfs_magic(struct mtd_info *mtd, size_t offset,
size_t *ret_offset,
enum mtdsplit_part_type *type)
{
- return -ENODEV;
+ return -ENOENT;
}
#endif /* CONFIG_MTD_SPLIT */
if (rootfs_offset == mtd->size) {
pr_debug("no rootfs found in \"%s\"\n", mtd->name);
- return -ENODEV;
+ return -ENOENT;
}
parts = kzalloc(ELF_NR_PARTS * sizeof(*parts), GFP_KERNEL);
of_property_read_string(np, "openwrt,cmdline-match", &cmdline_match);
if (cmdline_match && !strstr(saved_command_line, cmdline_match))
- return -ENODEV;
+ return -ENOENT;
of_property_read_u32(np, "openwrt,fit-offset", &offset_start);
if (fit_size == 0) {
pr_err("FIT image in \"%s\" at offset %llx has null size\n",
mtd->name, (unsigned long long) fit_offset);
- return -ENODEV;
+ return -ENOENT;
}
/*
if (images_noffset < 0) {
pr_err("Can't find images parent node '%s' (%s)\n",
FIT_IMAGES_PATH, fdt_strerror(images_noffset));
- return -ENODEV;
+ return -ENOENT;
}
for (ndepth = 0,
if (jimage_size == 0) {
pr_debug("no jImage found in \"%s\"\n", master->name);
- ret = -ENODEV;
+ ret = -ENOENT;
goto err_free_buf;
}
if (rootfs_size == 0) {
pr_debug("no rootfs found in \"%s\"\n", master->name);
- ret = -ENODEV;
+ ret = -ENOENT;
goto err_free_buf;
}
ret = mstcboot_parse_image_parts(mtd, pparts);
exit:
- /*
- * return 0 when ret=-ENODEV, to prevent deletion of
- * parent mtd partitions on Linux 6.7 and later
- */
- return ret == -ENODEV ? 0 : ret;
+ return ret;
}
static const struct of_device_id mtdsplit_mstcboot_of_match_table[] = {
if (trx_size == 0) {
pr_debug("no trx header found in \"%s\"\n", master->name);
- ret = -ENODEV;
+ ret = -ENOENT;
goto err;
}
if (rootfs_size == 0) {
pr_debug("no rootfs found in \"%s\"\n", master->name);
- ret = -ENODEV;
+ ret = -ENOENT;
goto err;
}
if (rootfs_size == 0) {
pr_debug("no rootfs found in \"%s\"\n", master->name);
- ret = -ENODEV;
+ ret = -ENOENT;
goto err_free_buf;
}