[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210517170401.188563-10-idosch@nvidia.com>
Date: Mon, 17 May 2021 20:03:59 +0300
From: Ido Schimmel <idosch@....NVIDIA.COM>
To: <netdev@...r.kernel.org>
CC: <davem@...emloft.net>, <kuba@...nel.org>, <jiri@....NVIDIA.COM>,
<petrm@....NVIDIA.COM>, <danieller@....NVIDIA.COM>,
<amcohen@....NVIDIA.COM>, <mlxsw@....NVIDIA.COM>,
Ido Schimmel <idosch@....NVIDIA.COM>,
Dan Carpenter <dan.carpenter@...cle.com>
Subject: [PATCH net-next 09/11] mlxsw: spectrum_router: Avoid missing error code warning
Explicitly set the error code to zero before the goto statement to avoid
the following smatch warning:
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:3598 mlxsw_sp_nexthop_group_refresh() warn: missing error code 'err'
The warning is a false positive, but the change both suppresses the
warning and makes it clear to future readers that this is not an error
path.
The original report and discussion can be found here [1].
[1] https://lore.kernel.org/lkml/202105141823.Td2h3Mbi-lkp@intel.com/
Cc: Dan Carpenter <dan.carpenter@...cle.com>
Suggested-by: Dan Carpenter <dan.carpenter@...cle.com>
Signed-off-by: Ido Schimmel <idosch@...dia.com>
Reviewed-by: Petr Machata <petrm@...dia.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
index 99015dca86c9..ec2af77a126d 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
@@ -3844,8 +3844,8 @@ mlxsw_sp_nexthop_group_refresh(struct mlxsw_sp *mlxsw_sp,
bool offload_change = false;
u32 adj_index;
bool old_adj_index_valid;
- int i, err2, err = 0;
u32 old_adj_index;
+ int i, err2, err;
if (!nhgi->gateway)
return mlxsw_sp_nexthop_fib_entries_update(mlxsw_sp, nh_grp);
@@ -3875,11 +3875,13 @@ mlxsw_sp_nexthop_group_refresh(struct mlxsw_sp *mlxsw_sp,
return 0;
}
mlxsw_sp_nexthop_group_normalize(nhgi);
- if (!nhgi->sum_norm_weight)
+ if (!nhgi->sum_norm_weight) {
/* No neigh of this group is connected so we just set
* the trap and let everthing flow through kernel.
*/
+ err = 0;
goto set_trap;
+ }
ecmp_size = nhgi->sum_norm_weight;
err = mlxsw_sp_fix_adj_grp_size(mlxsw_sp, &ecmp_size);
--
2.31.1
Powered by blists - more mailing lists