diff options
author | Parav Pandit <parav@nvidia.com> | 2021-02-19 10:36:54 +0300 |
---|---|---|
committer | Saeed Mahameed <saeedm@nvidia.com> | 2021-04-03 02:13:06 +0300 |
commit | 19779f28c96dfcc748fa079a2ffdec624feee5cd (patch) | |
tree | 9afbd03ebdf4548529e8b053223241ca9cb3b065 | |
parent | 6b30b6d4d36c978e0ab0f22e85bf3c646732e98b (diff) | |
download | linux-19779f28c96dfcc748fa079a2ffdec624feee5cd.tar.xz |
net/mlx5: Pair mutex_destory with mutex_init for rate limit table
Add missing mutex_destroy() to pair with mutex_init().
This should be done only when table is initialized, hence perform
mutex_init() only when table is initialized.
Signed-off-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/rl.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/rl.c b/drivers/net/ethernet/mellanox/mlx5/core/rl.c index 0526e3798c09..7161220afe30 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/rl.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/rl.c @@ -367,12 +367,13 @@ int mlx5_init_rl_table(struct mlx5_core_dev *dev) { struct mlx5_rl_table *table = &dev->priv.rl_table; - mutex_init(&table->rl_lock); if (!MLX5_CAP_GEN(dev, qos) || !MLX5_CAP_QOS(dev, packet_pacing)) { table->max_size = 0; return 0; } + mutex_init(&table->rl_lock); + /* First entry is reserved for unlimited rate */ table->max_size = MLX5_CAP_QOS(dev, packet_pacing_rate_table_size) - 1; table->max_rate = MLX5_CAP_QOS(dev, packet_pacing_max_rate); @@ -394,4 +395,5 @@ void mlx5_cleanup_rl_table(struct mlx5_core_dev *dev) return; mlx5_rl_table_free(dev, table); + mutex_destroy(&table->rl_lock); } |