mtd: nand: lpc32xx_slc: Remove unneeded NULL check on 'rc'
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Sun Feb 12 18:59:04 PST 2017
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=4339b7fdbb90ab579862b0fcde6ee0f342f12692
Commit: 4339b7fdbb90ab579862b0fcde6ee0f342f12692
Parent: 61babe943938bb41fcd7e2b1dec7d1537ea3892f
Author: Fabio Estevam <fabio.estevam at nxp.com>
AuthorDate: Tue Nov 29 13:28:52 2016 -0200
Committer: Boris Brezillon <boris.brezillon at free-electrons.com>
CommitDate: Mon Jan 30 11:50:30 2017 +0100
mtd: nand: lpc32xx_slc: Remove unneeded NULL check on 'rc'
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.
Signed-off-by: Fabio Estevam <fabio.estevam at nxp.com>
Acked-by: Marek Vasut <marek.vasut at gmail.com>
Acked-by: Vladimir Zapolskiy <vz at mleia.com>
Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.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) {
More information about the linux-mtd-cvs
mailing list