Skip to contentSkip to conversation

net: dsa: rzn1-a5psw: fix a NULL vs IS_ERR() check in a5psw_probe()

PATCH Applied Peng Wu 3 participants 3 messages Jun 28, 2022 – Jun 30, 2022

Subsystems (4)
lore
Share & tools
lore

Peng Wu

author
#0 lore raw

PATCH 1/1 net: dsa: rzn1-a5psw: fix a NULL vs IS_ERR() check in a5psw_probe()

The devm_platform_ioremap_resource() function never returns NULL. It returns error pointers.

---
 drivers/net/dsa/rzn1_a5psw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/dsa/rzn1_a5psw.c +2 -2
index 3e910da98ae2..5b14e2ba9b79 100644
@@ -946,8 +946,8 @@ static int a5psw_probe(struct platform_device *pdev)
 	mutex_init(&a5psw->lk_lock);
 	spin_lock_init(&a5psw->reg_lock);
 	a5psw->base = devm_platform_ioremap_resource(pdev, 0);
-	if (!a5psw->base)
-		return -EINVAL;
+	if (IS_ERR(a5psw->base))
+		return PTR_ERR(a5psw->base);
 
 	ret = a5psw_pcs_get(a5psw);
 	if (ret)
Signature · 1 line
2.17.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Peng Wu

The devm_platform_ioremap_resource() function never returns NULL. It returns error pointers.

---
 drivers/net/dsa/rzn1_a5psw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/dsa/rzn1_a5psw.c +0 -0
index 3e910da98ae2..5b14e2ba9b79 100644

drivers/net/dsa/rzn1_a5psw.c static int a5psw_probe(struct platform_device *pdev) · line 953

Quoted 10 lines
drivers/net/dsa/rzn1_a5psw.c +2 -2
@@ -946,8 +946,8 @@ static int a5psw_probe(struct platform_device *pdev)
 	mutex_init(&a5psw->lk_lock);
 	spin_lock_init(&a5psw->reg_lock);
 	a5psw->base = devm_platform_ioremap_resource(pdev, 0);
-	if (!a5psw->base)
-		return -EINVAL;
+	if (IS_ERR(a5psw->base))
+		return PTR_ERR(a5psw->base);
 
 	ret = a5psw_pcs_get(a5psw);
 	if (ret)

Thanks,

Signature · 3 lines
Clément Léger,
Embedded Linux and Kernel engineer at Bootlin
https://bootlin.com
#2 lore raw
In reply to Peng Wu
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Tue, 28 Jun 2022 13:09:20 +0000 you wrote:

The devm_platform_ioremap_resource() function never returns NULL. It returns error pointers.

---
 drivers/net/dsa/rzn1_a5psw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Here is the summary with links:
- net: dsa: rzn1-a5psw: fix a NULL vs IS_ERR() check in a5psw_probe()

    https://git.kernel.org/netdev/net-next/c/626af58bad58

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html