From: Richard Weinberger <richard@nod.at>
To: Brian Norris <computersforpeace@gmail.com>,
linux-mtd@lists.infradead.org
Subject: Re: [PATCH 3/4] mtd: fixup corner case error handling in mtd_device_parse_register()
Date: Tue, 02 Jun 2015 10:03:05 +0200 [thread overview]
Message-ID: <556D6339.70607@nod.at> (raw)
In-Reply-To: <1433200640-17858-3-git-send-email-computersforpeace@gmail.com>
Am 02.06.2015 um 01:17 schrieb Brian Norris:
> Since commit 3efe41be224c ("mtd: implement common reboot notifier
> boilerplate"), we might try to register a reboot notifier for an MTD
> that failed to register. Let's avoid this by making the error path
> clearer.
>
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
> ---
> drivers/mtd/mtdcore.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
> index 8bbbb751bf45..03eec42dc715 100644
> --- a/drivers/mtd/mtdcore.c
> +++ b/drivers/mtd/mtdcore.c
> @@ -579,9 +579,15 @@ int mtd_device_parse_register(struct mtd_info *mtd, const char * const *types,
> else
> ret = nr_parts;
> }
> + /* Didn't come up with either parsed OR fallback partitions */
> + if (ret < 0) {
> + pr_info("mtd: failed to find partitions\n");
> + goto out;
> + }
>
> - if (ret >= 0)
> - ret = mtd_add_device_partitions(mtd, real_parts, ret);
> + ret = mtd_add_device_partitions(mtd, real_parts, ret);
> + if (ret)
> + goto out;
>
> /*
> * FIXME: some drivers unfortunately call this function more than once.
> @@ -596,6 +602,7 @@ int mtd_device_parse_register(struct mtd_info *mtd, const char * const *types,
> register_reboot_notifier(&mtd->reboot_notifier);
> }
>
> +out:
> kfree(real_parts);
> return ret;
> }
Reviewed-by: Richard Weinberger <richard@nod.at>
Thanks,
//richard
next prev parent reply other threads:[~2015-06-02 8:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-01 23:17 [PATCH 1/4] mtd: diskonchip: remove two-phase partitioning / registration Brian Norris
2015-06-01 23:17 ` [PATCH 2/4] mtd: propagate error codes from add_mtd_device() Brian Norris
2015-06-02 8:02 ` Richard Weinberger
2015-06-03 0:00 ` Brian Norris
2015-06-01 23:17 ` [PATCH 3/4] mtd: fixup corner case error handling in mtd_device_parse_register() Brian Norris
2015-06-02 8:03 ` Richard Weinberger [this message]
2015-10-26 21:34 ` Brian Norris
2015-06-01 23:17 ` [PATCH 4/4] mtd: warn when registering the same master many times Brian Norris
2015-06-02 8:03 ` Richard Weinberger
2015-10-26 21:35 ` Brian Norris
2015-06-17 1:51 ` [PATCH 1/4] mtd: diskonchip: remove two-phase partitioning / registration Brian Norris
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=556D6339.70607@nod.at \
--to=richard@nod.at \
--cc=computersforpeace@gmail.com \
--cc=linux-mtd@lists.infradead.org \
/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).