From: Christophe Leroy <christophe.leroy@c-s.fr>
To: Mark Brown <broonie@kernel.org>
Cc: jogo@openwrt.org, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org
Subject: [PATCH] spi: fsl-spi: fix devm_ioremap_resource() error case
Date: Thu, 23 Apr 2015 14:11:47 +0200 (CEST) [thread overview]
Message-ID: <20150423121147.AFEA31A2439@localhost.localdomain> (raw)
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
next reply other threads:[~2015-04-23 12:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-23 12:11 Christophe Leroy [this message]
2015-04-24 12:38 ` [PATCH] spi: fsl-spi: fix devm_ioremap_resource() error case Mark Brown
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=20150423121147.AFEA31A2439@localhost.localdomain \
--to=christophe.leroy@c-s.fr \
--cc=broonie@kernel.org \
--cc=jogo@openwrt.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
/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;
as well as URLs for NNTP newsgroup(s).