From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: kyungmin.park@samsung.com, dwmw2@infradead.org,
computersforpeace@gmail.com, boris.brezillon@free-electrons.com,
marek.vasut@gmail.com, richard@nod.at,
cyrille.pitchen@wedev4u.fr
Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Subject: [PATCH 2/2 v2] mtd: onenand: samsung: return an error if 'mtd_device_parse_register()' fails
Date: Sat, 9 Dec 2017 08:24:05 +0100 [thread overview]
Message-ID: <b1d592c0ed60f1bda3d89145bcce5562c00e2575.1512804011.git.christophe.jaillet@wanadoo.fr> (raw)
In-Reply-To: <cover.1512804011.git.christophe.jaillet@wanadoo.fr>
In-Reply-To: <cover.1512804011.git.christophe.jaillet@wanadoo.fr>
If 'mtd_device_parse_register()' fails, we still return 0 which mean
success.
Return the error code instead, as done in all the other error handling
paths.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested-only
v2: call 'onenand_release()' to undo 'onenand_scan()'
---
drivers/mtd/onenand/samsung.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/mtd/onenand/samsung.c b/drivers/mtd/onenand/samsung.c
index 2e562c224060..4031f750f334 100644
--- a/drivers/mtd/onenand/samsung.c
+++ b/drivers/mtd/onenand/samsung.c
@@ -936,6 +936,11 @@ static int s3c_onenand_probe(struct platform_device *pdev)
err = mtd_device_parse_register(mtd, NULL, NULL,
pdata ? pdata->parts : NULL,
pdata ? pdata->nr_parts : 0);
+ if (err) {
+ dev_err(&pdev->dev, "failed to parse partitions and register the MTD device\n");
+ onenand_release(mtd);
+ return err;
+ }
platform_set_drvdata(pdev, mtd);
--
2.14.1
next prev parent reply other threads:[~2017-12-09 7:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-09 7:24 [PATCH 0/2 v2] mtd: onenand: samsung: Simplify code and fix leaks in error handling paths Christophe JAILLET
2017-12-09 7:24 ` [PATCH 1/2 v2] mtd: onenand: samsung: use devm_ function to simplify code and fix some leaks Christophe JAILLET
2017-12-09 8:33 ` Boris Brezillon
2017-12-09 7:24 ` Christophe JAILLET [this message]
2017-12-09 8:27 ` [PATCH 0/2 v2] mtd: onenand: samsung: Simplify code and fix leaks in error handling paths Boris Brezillon
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=b1d592c0ed60f1bda3d89145bcce5562c00e2575.1512804011.git.christophe.jaillet@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=boris.brezillon@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=cyrille.pitchen@wedev4u.fr \
--cc=dwmw2@infradead.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=richard@nod.at \
/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).