linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soc: ixp4xx: npe: Fix an IS_ERR() vs NULL check in probe
@ 2019-06-13  7:02 Dan Carpenter
  2019-06-18 11:35 ` Linus Walleij
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2019-06-13  7:02 UTC (permalink / raw)
  To: Krzysztof Halasa, Linus Walleij; +Cc: linux-kernel, kernel-janitors

The devm_ioremap_resource() function doesn't return NULL, it returns
error pointers.

Fixes: 0b458d7b10f8 ("soc: ixp4xx: npe: Pass addresses as resources")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/soc/ixp4xx/ixp4xx-npe.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/ixp4xx/ixp4xx-npe.c b/drivers/soc/ixp4xx/ixp4xx-npe.c
index bc10e3194809..ec90b44fa0cd 100644
--- a/drivers/soc/ixp4xx/ixp4xx-npe.c
+++ b/drivers/soc/ixp4xx/ixp4xx-npe.c
@@ -695,8 +695,8 @@ static int ixp4xx_npe_probe(struct platform_device *pdev)
 			continue; /* NPE already disabled or not present */
 		}
 		npe->regs = devm_ioremap_resource(dev, res);
-		if (!npe->regs)
-			return -ENOMEM;
+		if (IS_ERR(npe->regs))
+			return PTR_ERR(npe->regs);
 
 		if (npe_reset(npe)) {
 			dev_info(dev, "NPE%d at 0x%08x-0x%08x does not reset\n",
-- 
2.20.1


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

* Re: [PATCH] soc: ixp4xx: npe: Fix an IS_ERR() vs NULL check in probe
  2019-06-13  7:02 [PATCH] soc: ixp4xx: npe: Fix an IS_ERR() vs NULL check in probe Dan Carpenter
@ 2019-06-18 11:35 ` Linus Walleij
  2019-06-18 11:54   ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2019-06-18 11:35 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Krzysztof Halasa, linux-kernel, kernel-janitors, Olof Johansson

On Thu, Jun 13, 2019 at 9:02 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:

> The devm_ioremap_resource() function doesn't return NULL, it returns
> error pointers.
>
> Fixes: 0b458d7b10f8 ("soc: ixp4xx: npe: Pass addresses as resources")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Can you please collect my review and send this to the ARM SoC maintainers
arm@kernel.org since they are collecting a few other IXP4xx fixes?

Yours,
Linus Walleij

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

* [PATCH] soc: ixp4xx: npe: Fix an IS_ERR() vs NULL check in probe
  2019-06-18 11:35 ` Linus Walleij
@ 2019-06-18 11:54   ` Dan Carpenter
  2019-06-18 13:48     ` Olof Johansson
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2019-06-18 11:54 UTC (permalink / raw)
  To: arm; +Cc: Krzysztof Halasa, Linus Walleij, linux-kernel, kernel-janitors

The devm_ioremap_resource() function doesn't return NULL, it returns
error pointers.

Fixes: 0b458d7b10f8 ("soc: ixp4xx: npe: Pass addresses as resources")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/soc/ixp4xx/ixp4xx-npe.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/ixp4xx/ixp4xx-npe.c b/drivers/soc/ixp4xx/ixp4xx-npe.c
index bc10e3194809..ec90b44fa0cd 100644
--- a/drivers/soc/ixp4xx/ixp4xx-npe.c
+++ b/drivers/soc/ixp4xx/ixp4xx-npe.c
@@ -695,8 +695,8 @@ static int ixp4xx_npe_probe(struct platform_device *pdev)
 			continue; /* NPE already disabled or not present */
 		}
 		npe->regs = devm_ioremap_resource(dev, res);
-		if (!npe->regs)
-			return -ENOMEM;
+		if (IS_ERR(npe->regs))
+			return PTR_ERR(npe->regs);
 
 		if (npe_reset(npe)) {
 			dev_info(dev, "NPE%d at 0x%08x-0x%08x does not reset\n",
-- 
2.20.1

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

* Re: [PATCH] soc: ixp4xx: npe: Fix an IS_ERR() vs NULL check in probe
  2019-06-18 11:54   ` Dan Carpenter
@ 2019-06-18 13:48     ` Olof Johansson
  0 siblings, 0 replies; 4+ messages in thread
From: Olof Johansson @ 2019-06-18 13:48 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: arm, Krzysztof Halasa, Linus Walleij, linux-kernel, kernel-janitors

On Tue, Jun 18, 2019 at 02:54:10PM +0300, Dan Carpenter wrote:
> The devm_ioremap_resource() function doesn't return NULL, it returns
> error pointers.
> 
> Fixes: 0b458d7b10f8 ("soc: ixp4xx: npe: Pass addresses as resources")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Applied, thanks!


-Olof


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

end of thread, other threads:[~2019-06-18 13:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-13  7:02 [PATCH] soc: ixp4xx: npe: Fix an IS_ERR() vs NULL check in probe Dan Carpenter
2019-06-18 11:35 ` Linus Walleij
2019-06-18 11:54   ` Dan Carpenter
2019-06-18 13:48     ` Olof Johansson

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