From: "Rafał Miłecki" <zajec5@gmail.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>
Cc: "John Thomson" <lists@johnthomson.fastmail.com.au>,
linux-mtd@lists.infradead.org, "Rafał Miłecki" <rafal@milecki.pl>
Subject: [PATCH V2] mtd: mtdpart: check for subpartitions parsing result
Date: Wed, 27 Sep 2023 22:26:57 +0200 [thread overview]
Message-ID: <20230927202657.27169-1-zajec5@gmail.com> (raw)
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/
next reply other threads:[~2023-09-27 20:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-27 20:26 Rafał Miłecki [this message]
2023-10-16 9:28 ` [PATCH V2] mtd: mtdpart: check for subpartitions parsing result Miquel Raynal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230927202657.27169-1-zajec5@gmail.com \
--to=zajec5@gmail.com \
--cc=linux-mtd@lists.infradead.org \
--cc=lists@johnthomson.fastmail.com.au \
--cc=miquel.raynal@bootlin.com \
--cc=rafal@milecki.pl \
--cc=richard@nod.at \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).