diff options
author | Petr Machata <petrm@mellanox.com> | 2020-08-03 19:11:36 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-08-03 18:06:46 -0700 |
commit | 928345c08b72dd175d4eefa24900f09706a9a3b5 (patch) | |
tree | a4843904560cd2a7224fea92fd9320b038aafdf5 /drivers | |
parent | 76ba292cc7d7b760ee3e25aba353fb7ab86e64d3 (diff) | |
download | linux-928345c08b72dd175d4eefa24900f09706a9a3b5.tar.bz2 |
mlxsw: spectrum_span: On policer_id_base_ref_count, use dec_and_test
When unsetting policer base, the SPAN code currently uses refcount_dec().
However that function splats when the counter reaches zero, because
reaching zero without actually testing is in general indicative of a
missing cleanup. There is no cleanup to be done here, but nonetheless, use
refcount_dec_and_test() as required.
Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c index 323eaf979aea..5c959a995199 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c @@ -837,7 +837,8 @@ static int mlxsw_sp_span_policer_id_base_set(struct mlxsw_sp_span *span, static void mlxsw_sp_span_policer_id_base_unset(struct mlxsw_sp_span *span) { - refcount_dec(&span->policer_id_base_ref_count); + if (refcount_dec_and_test(&span->policer_id_base_ref_count)) + span->policer_id_base = 0; } static struct mlxsw_sp_span_entry * |