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>
{
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);
return;
mlx5_rl_table_free(dev, table);
+ mutex_destroy(&table->rl_lock);
}