From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Arushi Singhal <arushisinghal19971997@gmail.com>
Cc: dwmw2@infradead.org,
Boris Brezillon <boris.brezillon@free-electrons.com>,
Richard Weinberger <richard@nod.at>,
linux-kernel@vger.kernel.org, Marek Vasut <marek.vasut@gmail.com>,
linux-mtd@lists.infradead.org,
Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>,
Brian Norris <computersforpeace@gmail.com>
Subject: Re: [PATCH] mtd: devices: check mtd_device_register() return code
Date: Wed, 21 Mar 2018 09:01:23 +0100 [thread overview]
Message-ID: <20180321090123.07d55e32@xps13> (raw)
In-Reply-To: <20180321053709.GA5611@seema-Inspiron-15-3567>
Hi Arushi,
On Wed, 21 Mar 2018 11:07:09 +0530, Arushi Singhal
<arushisinghal19971997@gmail.com> wrote:
> stfsm_probe() misses error handling of mtd_device_register().
>
> Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
> ---
> drivers/mtd/devices/st_spi_fsm.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c
> index 7bc29d7..e1aa4f8 100644
> --- a/drivers/mtd/devices/st_spi_fsm.c
> +++ b/drivers/mtd/devices/st_spi_fsm.c
> @@ -2125,7 +2125,13 @@ static int stfsm_probe(struct platform_device *pdev)
> (long long)fsm->mtd.size, (long long)(fsm->mtd.size >> 20),
> fsm->mtd.erasesize, (fsm->mtd.erasesize >> 10));
>
> - return mtd_device_register(&fsm->mtd, NULL, 0);
> + ret = mtd_device_register(&fsm->mtd, NULL, 0);
> + if (ret) {
> + pr_err("Failed to register device\n");
> + return ret;
> + }
> +
> + return 0;
I don't think this bring anything. However, if you want to fix
something you should jump below on error to disable the clock instead
of returning 'ret' directly.
>
> err_clk_unprepare:
> clk_disable_unprepare(fsm->clk);
Thanks,
Miquèl
--
Miquel Raynal, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2018-03-21 8:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-21 5:37 [PATCH] mtd: devices: check mtd_device_register() return code Arushi Singhal
2018-03-21 8:01 ` Miquel Raynal [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-03-24 11:18 Arushi Singhal
2018-05-03 10:00 ` 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=20180321090123.07d55e32@xps13 \
--to=miquel.raynal@bootlin.com \
--cc=arushisinghal19971997@gmail.com \
--cc=boris.brezillon@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=cyrille.pitchen@wedev4u.fr \
--cc=dwmw2@infradead.org \
--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).