diff mbox series

[net] mlxsw: fix mlxsw_sp2_nve_vxlan_learning_set() return type

Message ID 6b2eb847-1d23-4b72-a1da-204df03f69d3@moroto.mountain (mailing list archive)
State Accepted
Commit 1e0b72a2a6432c0ef67ee5ce8d9172a7c20bba25
Delegated to: Netdev Maintainers
Headers show
Series [net] mlxsw: fix mlxsw_sp2_nve_vxlan_learning_set() return type | 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/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: 1340 this patch: 1340
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 1363 this patch: 1363
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: 1363 this patch: 1363
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Dan Carpenter Oct. 5, 2023, 2 p.m. UTC
The mlxsw_sp2_nve_vxlan_learning_set() function is supposed to return
zero on success or negative error codes.  So it needs to be type int
instead of bool.

Fixes: 4ee70efab68d ("mlxsw: spectrum_nve: Add support for VXLAN on Spectrum-2")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Petr Machata Oct. 6, 2023, 10:19 a.m. UTC | #1
Dan Carpenter <dan.carpenter@linaro.org> writes:

> The mlxsw_sp2_nve_vxlan_learning_set() function is supposed to return
> zero on success or negative error codes.  So it needs to be type int
> instead of bool.

Yes. Vast majority of the time the error code is 0, which converts to
false, which converts back to 0. But for errors this gets sliced to 1,
which eventually percolates to notifier_from_errno(), which yields
NOTIFY_STOP_MASK | NOTIFY_DONE instead of encoding the error code,
masking the failure.

> Fixes: 4ee70efab68d ("mlxsw: spectrum_nve: Add support for VXLAN on Spectrum-2")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Petr Machata <petrm@nvidia.com>

Thanks!

> ---
>  drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c
> index bb8eeb86edf7..52c2fe3644d4 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c
> @@ -310,8 +310,8 @@ const struct mlxsw_sp_nve_ops mlxsw_sp1_nve_vxlan_ops = {
>  	.fdb_clear_offload = mlxsw_sp_nve_vxlan_clear_offload,
>  };
>  
> -static bool mlxsw_sp2_nve_vxlan_learning_set(struct mlxsw_sp *mlxsw_sp,
> -					     bool learning_en)
> +static int mlxsw_sp2_nve_vxlan_learning_set(struct mlxsw_sp *mlxsw_sp,
> +					    bool learning_en)
>  {
>  	char tnpc_pl[MLXSW_REG_TNPC_LEN];
patchwork-bot+netdevbpf@kernel.org Oct. 8, 2023, 1:01 p.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Thu, 5 Oct 2023 17:00:12 +0300 you wrote:
> The mlxsw_sp2_nve_vxlan_learning_set() function is supposed to return
> zero on success or negative error codes.  So it needs to be type int
> instead of bool.
> 
> Fixes: 4ee70efab68d ("mlxsw: spectrum_nve: Add support for VXLAN on Spectrum-2")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> 
> [...]

Here is the summary with links:
  - [net] mlxsw: fix mlxsw_sp2_nve_vxlan_learning_set() return type
    https://git.kernel.org/netdev/net/c/1e0b72a2a643

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c
index bb8eeb86edf7..52c2fe3644d4 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c
@@ -310,8 +310,8 @@  const struct mlxsw_sp_nve_ops mlxsw_sp1_nve_vxlan_ops = {
 	.fdb_clear_offload = mlxsw_sp_nve_vxlan_clear_offload,
 };
 
-static bool mlxsw_sp2_nve_vxlan_learning_set(struct mlxsw_sp *mlxsw_sp,
-					     bool learning_en)
+static int mlxsw_sp2_nve_vxlan_learning_set(struct mlxsw_sp *mlxsw_sp,
+					    bool learning_en)
 {
 	char tnpc_pl[MLXSW_REG_TNPC_LEN];