* [PATCH V2] mtd: mtdpart: check for subpartitions parsing result
@ 2023-09-27 20:26 Rafał Miłecki
2023-10-16 9:28 ` Miquel Raynal
0 siblings, 1 reply; 2+ messages in thread
From: Rafał Miłecki @ 2023-09-27 20:26 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: John Thomson, linux-mtd, Rafał Miłecki
From: Rafał Miłecki <rafal@milecki.pl>
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>
---
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(-)
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 23483db8f30c..6811a714349d 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -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;
}
--
2.35.3
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-16 10:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-27 20:26 [PATCH V2] mtd: mtdpart: check for subpartitions parsing result Rafał Miłecki
2023-10-16 9:28 ` Miquel Raynal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).