[PATCH 5/9] mtd: remove NULLness check for IOMEM()

Ahmad Fatoum a.fatoum at pengutronix.de
Sat Oct 30 10:58:08 PDT 2021


While ioremap can fail, IOMEM() in our identity-mapped barebox can't.
Thus remove the never entered error branches.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/mtd/nand/atmel_nand.c         |  8 --------
 drivers/mtd/spi-nor/cadence-quadspi.c | 10 ----------
 2 files changed, 18 deletions(-)

diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 6bb41854e06b..cbd03e581b93 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -853,10 +853,6 @@ static int __init atmel_pmecc_nand_init_params(struct device_d *dev,
 	if (IS_ERR(iores))
 		return PTR_ERR(iores);
 	host->ecc = IOMEM(iores->start);
-	if (IS_ERR(host->ecc)) {
-		dev_err(host->dev, "ioremap failed\n");
-		return -EIO;
-	}
 
 	iores = dev_request_mem_resource(dev, 2);
 	if (IS_ERR(iores)) {
@@ -1210,10 +1206,6 @@ static int atmel_hw_nand_init_params(struct device_d *dev,
 	if (IS_ERR(iores))
 		return PTR_ERR(iores);
 	host->ecc = IOMEM(iores->start);
-	if (IS_ERR(host->ecc)) {
-		dev_err(host->dev, "ioremap failed\n");
-		return -EIO;
-	}
 
 	/* ECC is calculated for the whole page (1 step) */
 	nand_chip->ecc.size = mtd->writesize;
diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
index 72d1f4e7cec4..11423421692b 100644
--- a/drivers/mtd/spi-nor/cadence-quadspi.c
+++ b/drivers/mtd/spi-nor/cadence-quadspi.c
@@ -1192,21 +1192,11 @@ static int cqspi_probe(struct device_d *dev)
 	if (IS_ERR(iores))
 		return PTR_ERR(iores);
 	cqspi->iobase = IOMEM(iores->start);
-	if (IS_ERR(cqspi->iobase)) {
-		dev_err(dev, "dev_request_mem_region 0 failed\n");
-		ret = PTR_ERR(cqspi->iobase);
-		goto probe_failed;
-	}
 
 	iores = dev_request_mem_resource(dev, 1);
 	if (IS_ERR(iores))
 		return PTR_ERR(iores);
 	cqspi->ahb_base = IOMEM(iores->start);
-	if (IS_ERR(cqspi->ahb_base)) {
-		dev_err(dev, "dev_request_mem_region 0 failed\n");
-		ret = PTR_ERR(cqspi->ahb_base);
-		goto probe_failed;
-	}
 
 	cqspi_wait_idle(cqspi);
 	cqspi_controller_init(cqspi);
-- 
2.30.2




More information about the barebox mailing list