diff mbox series

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

Message ID 20220428211931.8130-1-dossche.niels@gmail.com (mailing list archive)
State Accepted
Commit e87f66b38e66dffdec9daa9f8f0eb044e9a62e3b
Delegated to: Netdev Maintainers
Headers show
Series net: mdio: Fix ENOMEM return value in BCM6368 mux bus controller | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 1 maintainers not CCed: edumazet@google.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Niels Dossche April 28, 2022, 9:19 p.m. UTC
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(-)

Comments

Andrew Lunn April 28, 2022, 10:56 p.m. UTC | #1
On Thu, Apr 28, 2022 at 11:19:32PM +0200, Niels Dossche 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")
> Signed-off-by: Niels Dossche <dossche.niels@gmail.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

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
Niels Dossche April 28, 2022, 11:07 p.m. UTC | #2
On 29/04/2022 00:56, Andrew Lunn wrote:
> On Thu, Apr 28, 2022 at 11:19:32PM +0200, Niels Dossche 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")
>> Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
> 
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> 
> 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

> 
>     Andrew
Florian Fainelli April 29, 2022, 4:04 p.m. UTC | #3
On 4/28/22 14:19, Niels Dossche 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")
> Signed-off-by: Niels Dossche <dossche.niels@gmail.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
patchwork-bot+netdevbpf@kernel.org April 30, 2022, 1:50 a.m. UTC | #4
Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

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")
> Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
> 
> [...]

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!
diff mbox series

Patch

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;