All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@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: Thu, 3 May 2018 12:00:27 +0200	[thread overview]
Message-ID: <20180503120027.4480765c@bbrezillon> (raw)
In-Reply-To: <20180324111820.GA1997@seema-Inspiron-15-3567>

On Sat, 24 Mar 2018 16:48:20 +0530
Arushi Singhal <arushisinghal19971997@gmail.com> wrote:

Subject prefix should be "mtd: devices: st_spi_fsm: ", and it's really
about checking return code which was already propagated to the lower
layer (platform bus), but it's about making sure we disable the clk we
have previously enabled in case of failure.

BTW, I see that the clk is not disabled in ->remove(), probably
something we should fix too (in a separate patch).

> 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..4a99a6a 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");
> +		goto err_clk_unprepare;
> +	}
> +
> +	return 0;
>  
>  err_clk_unprepare:
>  	clk_disable_unprepare(fsm->clk);

  reply	other threads:[~2018-05-03 10:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-24 11:18 [PATCH] mtd: devices: check mtd_device_register() return code Arushi Singhal
2018-05-03 10:00 ` Boris Brezillon [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-03-21  5:37 Arushi Singhal
2018-03-21  8:01 ` 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=20180503120027.4480765c@bbrezillon \
    --to=boris.brezillon@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.