[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <MJDKEQ.BWLP6TXTA14J1@crapouillou.net>
Date: Wed, 05 Aug 2020 02:04:34 +0200
From: Paul Cercueil <paul@...pouillou.net>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Krzysztof Kozlowski <krzk@...nel.org>,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] memory: jz4780_nemc: Fix an error pointer vs NULL check
in probe()
Le lun. 3 août 2020 à 17:36, Dan Carpenter <dan.carpenter@...cle.com>
a écrit :
> 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
Reviewed-by: Paul Cercueil <paul@...pouillou.net>
Thanks!
-Paul
> ---
> 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);
> --
> 2.27.0
>
Powered by blists - more mailing lists