linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] memory: jz4780-nemc: Fix return value check in jz4780_nemc_probe()
@ 2020-08-04  8:24 Wei Yongjun
  2020-08-04  8:31 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2020-08-04  8:24 UTC (permalink / raw)
  To: Paul Cercueil, Krzysztof Kozlowski
  Cc: Wei Yongjun, linux-kernel, kernel-janitors, Hulk Robot

In case of error, the function devm_ioremap() returns NULL pointer not
ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.

Fixes: f046e4a3f0b9 ("memory: jz4780_nemc: Only request IO memory the driver will use")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/memory/jz4780-nemc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/memory/jz4780-nemc.c b/drivers/memory/jz4780-nemc.c
index 3ec5cb0fce1e..608ae925e641 100644
--- a/drivers/memory/jz4780-nemc.c
+++ b/drivers/memory/jz4780-nemc.c
@@ -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);




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

* Re: [PATCH] memory: jz4780-nemc: Fix return value check in jz4780_nemc_probe()
  2020-08-04  8:24 [PATCH] memory: jz4780-nemc: Fix return value check in jz4780_nemc_probe() Wei Yongjun
@ 2020-08-04  8:31 ` Krzysztof Kozlowski
  0 siblings, 0 replies; 2+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-04  8:31 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: Paul Cercueil, linux-kernel, kernel-janitors, Hulk Robot

On Tue, Aug 04, 2020 at 08:24:03AM +0000, Wei Yongjun wrote:
> In case of error, the function devm_ioremap() returns NULL pointer not
> ERR_PTR(). The IS_ERR() test in the return value check should be
> replaced with NULL test.
> 
> Fixes: f046e4a3f0b9 ("memory: jz4780_nemc: Only request IO memory the driver will use")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/memory/jz4780-nemc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Thanks for the patch. The fix was already posted by Dan:
https://lore.kernel.org/lkml/20200803143607.GC346925@mwanda/

Best regards,
Krzysztof

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

end of thread, other threads:[~2020-08-04  8:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-04  8:24 [PATCH] memory: jz4780-nemc: Fix return value check in jz4780_nemc_probe() Wei Yongjun
2020-08-04  8:31 ` Krzysztof Kozlowski

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).