Commit efa6bc91 authored by Eran Ben Elisha's avatar Eran Ben Elisha Committed by David S. Miller

net/mlx4_core: Check before cleaning counters bitmap

If counters are not supported by the device. The indices bitmap table is not
allocated during initialization. Add the symmetrical check before cleaning
the counters bitmap table or freeing a counter.
Signed-off-by: default avatarEran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: default avatarHadar Hen Zion <hadarh@mellanox.com>
Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b4ad7baa
...@@ -2204,6 +2204,9 @@ static int mlx4_init_counters_table(struct mlx4_dev *dev) ...@@ -2204,6 +2204,9 @@ static int mlx4_init_counters_table(struct mlx4_dev *dev)
static void mlx4_cleanup_counters_table(struct mlx4_dev *dev) static void mlx4_cleanup_counters_table(struct mlx4_dev *dev)
{ {
if (!(dev->caps.flags & MLX4_DEV_CAP_FLAG_COUNTERS))
return;
mlx4_bitmap_cleanup(&mlx4_priv(dev)->counters_bitmap); mlx4_bitmap_cleanup(&mlx4_priv(dev)->counters_bitmap);
} }
...@@ -2241,6 +2244,9 @@ EXPORT_SYMBOL_GPL(mlx4_counter_alloc); ...@@ -2241,6 +2244,9 @@ EXPORT_SYMBOL_GPL(mlx4_counter_alloc);
void __mlx4_counter_free(struct mlx4_dev *dev, u32 idx) void __mlx4_counter_free(struct mlx4_dev *dev, u32 idx)
{ {
if (!(dev->caps.flags & MLX4_DEV_CAP_FLAG_COUNTERS))
return;
mlx4_bitmap_free(&mlx4_priv(dev)->counters_bitmap, idx, MLX4_USE_RR); mlx4_bitmap_free(&mlx4_priv(dev)->counters_bitmap, idx, MLX4_USE_RR);
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment