diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2020-08-03 17:36:07 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-12-30 13:54:27 +0300 |
commit | e6fc90d170df77583edc90d132a796d3abda1fba (patch) | |
tree | 5e696b2a8bf38bd22a90546b2a8368cb6a7579bd /drivers/memory | |
parent | c88347ae936482f079cc17eac405f3f54e839a8d (diff) | |
download | linux-e6fc90d170df77583edc90d132a796d3abda1fba.tar.xz |
memory: jz4780_nemc: Fix an error pointer vs NULL check in probe()
commit 96999c797ec1ef41259f00b4ddf9cf33b342cb78 upstream.
The devm_ioremap() function returns NULL on error, it doesn't return
error pointers. This bug could lead to an Oops during probe.
Fixes: f046e4a3f0b9 ("memory: jz4780_nemc: Only request IO memory the driver will use")
Cc: <stable@vger.kernel.org>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20200803143607.GC346925@mwanda
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/memory')
-rw-r--r-- | drivers/memory/jz4780-nemc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/memory/jz4780-nemc.c b/drivers/memory/jz4780-nemc.c index 465ea92990d7..555f7ac3b7dd 100644 --- a/drivers/memory/jz4780-nemc.c +++ b/drivers/memory/jz4780-nemc.c @@ -306,9 +306,9 @@ static int jz4780_nemc_probe(struct platform_device *pdev) } nemc->base = devm_ioremap(dev, res->start, NEMC_REG_LEN); - if (IS_ERR(nemc->base)) { + if (!nemc->base) { dev_err(dev, "failed to get I/O memory\n"); - return PTR_ERR(nemc->base); + return -ENOMEM; } writel(0, nemc->base + NEMC_NFCSR); |