]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
mlxsw: spectrum_router: Fix rif counter freeing routine
[karo-tx-linux.git] / drivers / net / ethernet / mellanox / mlxsw / spectrum_router.c
index 33cec1cc164259ad9d7dd022a811e957447a61ff..9f89c4137d2137f78bcda8f79a918b8db61a5189 100644 (file)
@@ -206,6 +206,9 @@ void mlxsw_sp_rif_counter_free(struct mlxsw_sp *mlxsw_sp,
 {
        unsigned int *p_counter_index;
 
+       if (!mlxsw_sp_rif_counter_valid_get(rif, dir))
+               return;
+
        p_counter_index = mlxsw_sp_rif_p_counter_get(rif, dir);
        if (WARN_ON(!p_counter_index))
                return;