public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: linux-mtd@lists.infradead.org,
	Allison Randal <allison@lohutok.net>,
	Armijn Hemel <armijn@tjaldur.nl>,
	Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Lee Jones <lee.jones@linaro.org>,
	Marek Vasut <marek.vasut@gmail.com>,
	Richard Weinberger <richard@nod.at>,
	Thomas Gleixner <tglx@linutronix.de>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Himanshu Jha <himanshujha199640@gmail.com>
Subject: Re: [PATCH] mtd: st_spi_fsm: Use devm_platform_ioremap_resource() in stfsm_probe()
Date: Thu, 19 Sep 2019 11:10:14 +0200	[thread overview]
Message-ID: <20190919111014.6c569cf3@xps13> (raw)
In-Reply-To: <e1d32aa4-7c82-64e0-b7c4-33c94d9a2769@web.de>

Hi Markus,

Markus Elfring <Markus.Elfring@web.de> wrote on Wed, 18 Sep 2019
14:50:27 +0200:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 18 Sep 2019 14:37:34 +0200
> 
> Simplify this function implementation by using a known wrapper function.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/mtd/devices/st_spi_fsm.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c
> index f4d1667daaf9..5bd1c44ae529 100644
> --- a/drivers/mtd/devices/st_spi_fsm.c
> +++ b/drivers/mtd/devices/st_spi_fsm.c
> @@ -2034,13 +2034,7 @@ static int stfsm_probe(struct platform_device *pdev)
> 
>  	platform_set_drvdata(pdev, fsm);
> 
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!res) {
> -		dev_err(&pdev->dev, "Resource not found\n");
> -		return -ENODEV;
> -	}
> -
> -	fsm->base = devm_ioremap_resource(&pdev->dev, res);
> +	fsm->base = devm_platform_ioremap_resource(pdev, 0);
>  	if (IS_ERR(fsm->base)) {
>  		dev_err(&pdev->dev,
>  			"Failed to reserve memory region %pR\n", res);
> --
> 2.23.0
> 


Is this even compiled tested? 'res' is not initialized anymore so you
can't use it in the error trace. I suppose you should even drop it from
the stack parameters.

Thanks,
Miquèl

  reply	other threads:[~2019-09-19  9:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-18 12:50 [PATCH] mtd: st_spi_fsm: Use devm_platform_ioremap_resource() in stfsm_probe() Markus Elfring
2019-09-19  9:10 ` Miquel Raynal [this message]
2019-09-19 10:50   ` Markus Elfring
2019-09-19 11:29   ` Greg Kroah-Hartman
2019-09-19 11:35     ` Miquel Raynal
2019-09-19 12:16       ` Markus Elfring
2019-09-19 12:04   ` [PATCH v2] " Markus Elfring

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=20190919111014.6c569cf3@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=Markus.Elfring@web.de \
    --cc=allison@lohutok.net \
    --cc=armijn@tjaldur.nl \
    --cc=bgolaszewski@baylibre.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=himanshujha199640@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=richard@nod.at \
    --cc=tglx@linutronix.de \
    --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