vdpa/mlx5: Add and remove debugfs in setup/teardown driver
A message that is not in the archive (sent off-list or not yet received): [email protected]
Jason Wang
Acked-byQuoted 10 lines · Eli Cohen
The right place to add the debugfs create is in
setup_driver()and remove it inteardown_driver().Current code adds the debugfs when creating the device but resetting a device will remove the debugfs subtree and subsequent
set_driverwill not be able to create the files since the debugfs pointer is NULL.Fixes 294221004322 ("vdpa/mlx5: Add debugfs subtree")Signed-off-by Eli Cohen <[email protected]>
Acked-by Jason Wang <[email protected]>
Thanks
Quoted 51 lines
v3 -> v4:
Fix error flow insetup_driver()--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)drivers/vdpa/mlx5/net/mlx5_vnet.c +6
-3@@ -2491,10 +2491,11 @@ static int setup_driver(struct mlx5_vdpa_dev *mvdev) err =0 ; goto out; } +mlx5_vdpa_add_debugfs (ndev); err =setup_virtqueues (mvdev);if (err) {mlx5_vdpa_warn (mvdev,"setup_virtqueues\n" ); - goto out; + goto err_setup; } err =create_rqt (ndev);@@ -2524,6 +2525,8 @@ static int setup_driver(struct mlx5_vdpa_dev *mvdev)destroy_rqt (ndev); err_rqt:teardown_virtqueues (ndev); +err_setup: +mlx5_vdpa_remove_debugfs (ndev->debugfs); out:return err; }@@ -2537,6 +2540,8 @@ static void teardown_driver(struct mlx5_vdpa_net *ndev)if (!ndev->setup)return ; +mlx5_vdpa_remove_debugfs (ndev->debugfs); + ndev->debugfs =NULL ;teardown_steering (ndev);destroy_tir (ndev);destroy_rqt (ndev);@@ -3287,7 +3292,6 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,if (err) goto err_reg; -mlx5_vdpa_add_debugfs (ndev); mgtdev->ndev = ndev;return 0 ; --
Quoted 2 lines
2.38.1
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization