public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Fabio Estevam <fabio.estevam@nxp.com>
Cc: <marek.vasut@gmail.com>, <cyrille.pitchen@atmel.com>,
	<vz@mleia.com>, <linux-mtd@lists.infradead.org>
Subject: Re: [PATCH] mtd: nand: lpc32xx_slc: Remove unneeded NULL check on 'rc'
Date: Tue, 3 Jan 2017 11:55:35 +0100	[thread overview]
Message-ID: <20170103115535.0d295f19@bbrezillon> (raw)
In-Reply-To: <1480433332-2090-1-git-send-email-fabio.estevam@nxp.com>

On Tue, 29 Nov 2016 13:28:52 -0200
Fabio Estevam <fabio.estevam@nxp.com> wrote:

> devm_ioremap_resource() does a NULL check on the 'rc' argument, so
> remove the unneeded manual NULL check.
> 
> While at it, place the 'rc' assignment just before
> devm_ioremap_resource() to improve readability.
> 

Applied.

Thanks,

Boris

> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
> ---
>  drivers/mtd/nand/lpc32xx_slc.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/mtd/nand/lpc32xx_slc.c b/drivers/mtd/nand/lpc32xx_slc.c
> index 53bafe2..a0669a3 100644
> --- a/drivers/mtd/nand/lpc32xx_slc.c
> +++ b/drivers/mtd/nand/lpc32xx_slc.c
> @@ -797,22 +797,17 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
>  	struct resource *rc;
>  	int res;
>  
> -	rc = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (rc == NULL) {
> -		dev_err(&pdev->dev, "No memory resource found for device\n");
> -		return -EBUSY;
> -	}
> -
>  	/* Allocate memory for the device structure (and zero it) */
>  	host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL);
>  	if (!host)
>  		return -ENOMEM;
> -	host->io_base_dma = rc->start;
>  
> +	rc = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	host->io_base = devm_ioremap_resource(&pdev->dev, rc);
>  	if (IS_ERR(host->io_base))
>  		return PTR_ERR(host->io_base);
>  
> +	host->io_base_dma = rc->start;
>  	if (pdev->dev.of_node)
>  		host->ncfg = lpc32xx_parse_dt(&pdev->dev);
>  	if (!host->ncfg) {

      parent reply	other threads:[~2017-01-03 10:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-29 15:28 [PATCH] mtd: nand: lpc32xx_slc: Remove unneeded NULL check on 'rc' Fabio Estevam
2016-11-29 17:30 ` Marek Vasut
2016-11-29 19:04   ` Fabio Estevam
2016-12-08  1:44 ` Vladimir Zapolskiy
2017-01-03 10:55 ` Boris Brezillon [this message]

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=20170103115535.0d295f19@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=cyrille.pitchen@atmel.com \
    --cc=fabio.estevam@nxp.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=vz@mleia.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