linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: fsl-spi: fix devm_ioremap_resource() error case
@ 2015-04-23 12:11 Christophe Leroy
  2015-04-24 12:38 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe Leroy @ 2015-04-23 12:11 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, linuxppc-dev, linux-spi, jogo

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

Reported-by: Jonas Gorsky <jogo@openwrt.org>
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>

---
 drivers/spi/spi-fsl-cpm.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-fsl-cpm.c b/drivers/spi/spi-fsl-cpm.c
index 4e5c945..1e66644 100644
--- a/drivers/spi/spi-fsl-cpm.c
+++ b/drivers/spi/spi-fsl-cpm.c
@@ -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);
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] spi: fsl-spi: fix devm_ioremap_resource() error case
  2015-04-23 12:11 [PATCH] spi: fsl-spi: fix devm_ioremap_resource() error case Christophe Leroy
@ 2015-04-24 12:38 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2015-04-24 12:38 UTC (permalink / raw)
  To: Christophe Leroy; +Cc: linux-kernel, linuxppc-dev, linux-spi, jogo

[-- Attachment #1: Type: text/plain, Size: 155 bytes --]

On Thu, Apr 23, 2015 at 02:11:47PM +0200, Christophe Leroy wrote:
> devm_ioremap_resource() doesn't return NULL but an ERR_PTR on error.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-24 12:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-23 12:11 [PATCH] spi: fsl-spi: fix devm_ioremap_resource() error case Christophe Leroy
2015-04-24 12:38 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).