netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: mdio: Fix ENOMEM return value in BCM6368 mux bus controller
@ 2022-04-28 21:19 Niels Dossche
  2022-04-28 22:56 ` Andrew Lunn
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Niels Dossche @ 2022-04-28 21:19 UTC (permalink / raw)
  To: netdev
  Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Jakub Kicinski, Paolo Abeni, noltari, 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")
Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
---

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

diff --git a/drivers/net/mdio/mdio-mux-bcm6368.c b/drivers/net/mdio/mdio-mux-bcm6368.c
index 6dcbf987d61b..8b444a8eb6b5 100644
--- a/drivers/net/mdio/mdio-mux-bcm6368.c
+++ b/drivers/net/mdio/mdio-mux-bcm6368.c
@@ -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;
-- 
2.35.2


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

end of thread, other threads:[~2022-04-30  1:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-28 21:19 [PATCH] net: mdio: Fix ENOMEM return value in BCM6368 mux bus controller Niels Dossche
2022-04-28 22:56 ` Andrew Lunn
2022-04-28 23:07   ` Niels Dossche
2022-04-29 16:04 ` Florian Fainelli
2022-04-30  1:50 ` patchwork-bot+netdevbpf

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