Commit 96999c79 authored by Dan Carpenter's avatar Dan Carpenter Committed by Krzysztof Kozlowski

memory: jz4780_nemc: Fix an error pointer vs NULL check in probe()

The devm_ioremap() function returns NULL on error, it doesn't return
error pointers.  This bug could lead to an Oops during probe.

Fixes: f046e4a3 ("memory: jz4780_nemc: Only request IO memory the driver will use")
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarPaul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20200803143607.GC346925@mwandaSigned-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
parent 3650b228
......@@ -304,9 +304,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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment