diff mbox series

[net] net: dsa: mv88e6xxx: Fix switchdev error code

Message ID 20241217043930.260536-1-elliot.ayrey@alliedtelesis.co.nz (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net] net: dsa: mv88e6xxx: Fix switchdev error code | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
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/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 5 this patch: 5
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
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, 6 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-12-17--06-01 (tests: 795)

Commit Message

Elliot Ayrey Dec. 17, 2024, 4:39 a.m. UTC
Calling a switchdev notifier encodes additional information into the
return code. Using this value directly makes error messages confusing.

Use notifer_to_errno() to restore the original errno value.

Fixes: 830763b96720 ("net: dsa: mv88e6xxx: mac-auth/MAB implementation")
Signed-off-by: Elliot Ayrey <elliot.ayrey@alliedtelesis.co.nz>
---
 drivers/net/dsa/mv88e6xxx/switchdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andrew Lunn Dec. 17, 2024, 9:54 a.m. UTC | #1
On Tue, Dec 17, 2024 at 05:39:30PM +1300, Elliot Ayrey wrote:
> Calling a switchdev notifier encodes additional information into the
> return code. Using this value directly makes error messages confusing.
> 
> Use notifer_to_errno() to restore the original errno value.
> 
> Fixes: 830763b96720 ("net: dsa: mv88e6xxx: mac-auth/MAB implementation")
> Signed-off-by: Elliot Ayrey <elliot.ayrey@alliedtelesis.co.nz>
> ---
>  drivers/net/dsa/mv88e6xxx/switchdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/dsa/mv88e6xxx/switchdev.c b/drivers/net/dsa/mv88e6xxx/switchdev.c
> index 4c346a884fb2..7c59eca0270d 100644
> --- a/drivers/net/dsa/mv88e6xxx/switchdev.c
> +++ b/drivers/net/dsa/mv88e6xxx/switchdev.c
> @@ -79,5 +79,5 @@ int mv88e6xxx_handle_miss_violation(struct mv88e6xxx_chip *chip, int port,
>  				       brport, &info.info, NULL);
>  	rtnl_unlock();
>  
> -	return err;
> +	return notifier_to_errno(err);

I just had a quick look at other users of call_switchdev_notifiers()
and all but vxlan_core.c and this one discarded the return
value. Would that be a better fix, making the code more uniform?

	Andrew
diff mbox series

Patch

diff --git a/drivers/net/dsa/mv88e6xxx/switchdev.c b/drivers/net/dsa/mv88e6xxx/switchdev.c
index 4c346a884fb2..7c59eca0270d 100644
--- a/drivers/net/dsa/mv88e6xxx/switchdev.c
+++ b/drivers/net/dsa/mv88e6xxx/switchdev.c
@@ -79,5 +79,5 @@  int mv88e6xxx_handle_miss_violation(struct mv88e6xxx_chip *chip, int port,
 				       brport, &info.info, NULL);
 	rtnl_unlock();
 
-	return err;
+	return notifier_to_errno(err);
 }