else
                esw->offloads.encap = DEVLINK_ESWITCH_ENCAP_MODE_NONE;
 
+       mutex_init(&esw->offloads.termtbl_mutex);
        mlx5_rdma_enable_roce(esw->dev);
        err = esw_offloads_steering_init(esw);
        if (err)
                goto err_vports;
 
        esw_offloads_devcom_init(esw);
-       mutex_init(&esw->offloads.termtbl_mutex);
 
        return 0;
 
        esw_offloads_steering_cleanup(esw);
 err_steering_init:
        mlx5_rdma_disable_roce(esw->dev);
+       mutex_destroy(&esw->offloads.termtbl_mutex);
        return err;
 }
 
        esw_set_passing_vport_metadata(esw, false);
        esw_offloads_steering_cleanup(esw);
        mlx5_rdma_disable_roce(esw->dev);
+       mutex_destroy(&esw->offloads.termtbl_mutex);
        esw->offloads.encap = DEVLINK_ESWITCH_ENCAP_MODE_NONE;
 }