Skip to contentSkip to conversation

spi: fsl-spi: fix devm_ioremap_resource() error case

PATCH Applied Christophe Leroy 2 participants 2 messages Apr 23, 2015 – Apr 24, 2015 SPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: fsl-spi: fix devm_ioremap_resource() error case

devm_ioremap_resource() doesn't return NULL but an ERR_PTR on error.

---
 drivers/spi/spi-fsl-cpm.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/spi/spi-fsl-cpm.c +6 -1
index 4e5c945..1e66644 100644
@@ -305,10 +305,15 @@ int fsl_spi_cpm_init(struct mpc8xxx_spi *mspi)
 
 	if (mspi->flags & SPI_CPM1) {
 		struct resource *res;
+		void *pram;
 
 		res = platform_get_resource(to_platform_device(dev),
 					    IORESOURCE_MEM, 1);
-		mspi->pram = devm_ioremap_resource(dev, res);
+		pram = devm_ioremap_resource(dev, res);
+		if (IS_ERR(pram))
+			mspi->pram = NULL;
+		else
+			mspi->pram = pram;
 	} else {
 		unsigned long pram_ofs = fsl_spi_cpm_get_pram(mspi);
 
Signature · 6 lines
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer Applied
#1 lore raw
Quoted 1 line · Christophe Leroy

devm_ioremap_resource() doesn't return NULL but an ERR_PTR on error.

Applied, thanks.