mtd: mtdpart: check for subpartitions parsing result
PATCH v2 1/1 mtd: mtdpart: check for subpartitions parsing result
From: Rafał Miłecki <[email protected]>
parse_mtd_partitions() may return an error so it should be checked and optionally passed up
Signed-off-by Rafał Miłecki <[email protected]>
---
V2: Use "ret < 0" as ret contains no of parts on success. Thanks John!
drivers/mtd/mtdpart.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/mtd/mtdpart.c +5 -1
@@ -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; }
Signature · 6 lines
2.35.3 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Quoted 6 lines · On Wed, 2023-09-27 at 20:26:57 UTC, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= wrote:
From: Rafał Miłecki <[email protected]>
parse_mtd_partitions()may return an error so it should be checked and optionally passed upSigned-off-by Rafał Miłecki <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.
Miquel
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/