[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201228125054.567961515@linuxfoundation.org>
Date: Mon, 28 Dec 2020 13:51:39 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Dan Carpenter <dan.carpenter@...cle.com>,
Paul Cercueil <paul@...pouillou.net>,
Krzysztof Kozlowski <krzk@...nel.org>
Subject: [PATCH 5.10 701/717] memory: jz4780_nemc: Fix an error pointer vs NULL check in probe()
From: Dan Carpenter <dan.carpenter@...cle.com>
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@...r.kernel.org>
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
Reviewed-by: Paul Cercueil <paul@...pouillou.net>
Link: https://lore.kernel.org/r/20200803143607.GC346925@mwanda
Signed-off-by: Krzysztof Kozlowski <krzk@...nel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/memory/jz4780-nemc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/memory/jz4780-nemc.c
+++ b/drivers/memory/jz4780-nemc.c
@@ -306,9 +306,9 @@ static int jz4780_nemc_probe(struct plat
}
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);
Powered by blists - more mailing lists