diff options
author | Eran Ben Elisha <eranbe@mellanox.com> | 2015-06-15 17:58:56 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-06-16 03:23:01 +0300 |
commit | efa6bc91cb85e03412c526c3ad0d2a9d733b5c6e (patch) | |
tree | 0746338815d04ade2ce32327984821e6b2dd55fe /drivers/net/ethernet/mellanox/mlx4/main.c | |
parent | b4ad7baa01970d2c5096fbbcb0c593e199c6f18b (diff) | |
download | linux-efa6bc91cb85e03412c526c3ad0d2a9d733b5c6e.tar.xz |
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: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/main.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/main.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 7d57777e65c5..ad81364272e4 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c @@ -2204,6 +2204,9 @@ static int mlx4_init_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); } @@ -2241,6 +2244,9 @@ EXPORT_SYMBOL_GPL(mlx4_counter_alloc); 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); return; } |