Skip to contentSkip to conversation

net: mdio: Fix ENOMEM return value in BCM6368 mux bus controller

PATCH Applied Niels Dossche 4 participants 5 messages Apr 28, 2022 – Apr 30, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: mdio: Fix ENOMEM return value in BCM6368 mux bus controller

Error values inside the probe function must be < 0. The ENOMEM return value has the wrong sign: it is positive instead of negative. Add a minus sign.

Fixes e239756717b5 ("net: mdio: Add BCM6368 MDIO mux bus controller")

---

Note:
I found this issue using my own-developed static analysis tool to find inconsistent error return values. As I do not have the necessary hardware to test, I could not test this patch. I found this issue on v5.17.4. I manually verified the issue report by looking at the code.

 drivers/net/mdio/mdio-mux-bcm6368.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mdio/mdio-mux-bcm6368.c +1 -1
index 6dcbf987d61b..8b444a8eb6b5 100644
@@ -115,7 +115,7 @@ static int bcm6368_mdiomux_probe(struct platform_device *pdev)
 	md->mii_bus = devm_mdiobus_alloc(&pdev->dev);
 	if (!md->mii_bus) {
 		dev_err(&pdev->dev, "mdiomux bus alloc failed\n");
-		return ENOMEM;
+		return -ENOMEM;
 	}
 
 	bus = md->mii_bus;
Signature · 1 line
2.35.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Niels Dossche

Error values inside the probe function must be < 0. The ENOMEM return value has the wrong sign: it is positive instead of negative. Add a minus sign.

Fixes e239756717b5 ("net: mdio: Add BCM6368 MDIO mux bus controller")

Hi Niels

If you find any more issues like this in the network stack and its drivers, please take a read of

https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html

Andrew

#2 lore raw
Quoted 8 lines · Andrew Lunn
Quoted 6 lines · Niels Dossche

Error values inside the probe function must be < 0. The ENOMEM return value has the wrong sign: it is positive instead of negative. Add a minus sign.

Fixes e239756717b5 ("net: mdio: Add BCM6368 MDIO mux bus controller")
Quoted 8 lines

Hi Niels

If you find any more issues like this in the network stack and its drivers, please take a read of

https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html

Hi Andrew

Thanks for the review.
My apologies, I will make sure to correctly tag the tree in the subject in the future.

Kind regards
Niels

Quoted 2 lines

Andrew

#4 lore raw
In reply to Niels Dossche
This patch was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:

Hello:

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

Quoted 8 lines · On Thu, 28 Apr 2022 23:19:32 +0200 you wrote:

Error values inside the probe function must be < 0. The ENOMEM return value has the wrong sign: it is positive instead of negative. Add a minus sign.

Fixes e239756717b5 ("net: mdio: Add BCM6368 MDIO mux bus controller")

[...]

Here is the summary with links:
- net: mdio: Fix ENOMEM return value in BCM6368 mux bus controller

    https://git.kernel.org/netdev/net/c/e87f66b38e66

You are awesome, thank you!

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