Skip to content

Commit 5c2f772

Browse files
Rafał Miłeckimiquelraynal
authored andcommitted
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 <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
1 parent 8baba8d commit 5c2f772

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/mtd/mtdpart.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,11 @@ int add_mtd_partitions(struct mtd_info *parent,
426426
mtd_add_partition_attrs(child);
427427

428428
/* Look for subpartitions */
429-
parse_mtd_partitions(child, parts[i].types, NULL);
429+
ret = parse_mtd_partitions(child, parts[i].types, NULL);
430+
if (ret < 0) {
431+
pr_err("Failed to parse subpartitions: %d\n", ret);
432+
goto err_del_partitions;
433+
}
430434

431435
cur_offset = child->part.offset + child->part.size;
432436
}

0 commit comments

Comments
 (0)