mtd: mtdpart: check for subpartitions parsing result

parse_mtd_partitions() may return an error so it should be checked and
optionally passed up

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20230927202657.27169-1-zajec5@gmail.com
This commit is contained in:
Rafał Miłecki 2023-09-27 22:26:57 +02:00 committed by Miquel Raynal
parent 8baba8d52f
commit 5c2f7727d4

View File

@ -426,7 +426,11 @@ int add_mtd_partitions(struct mtd_info *parent,
mtd_add_partition_attrs(child);
/* Look for subpartitions */
parse_mtd_partitions(child, parts[i].types, NULL);
ret = parse_mtd_partitions(child, parts[i].types, NULL);
if (ret < 0) {
pr_err("Failed to parse subpartitions: %d\n", ret);
goto err_del_partitions;
}
cur_offset = child->part.offset + child->part.size;
}