Skip to content

Commit f0417e7

Browse files
elic307imstsirkin
authored andcommitted
vdpa/mlx5: Add and remove debugfs in setup/teardown driver
The right place to add the debugfs create is in setup_driver() and remove it in teardown_driver(). Current code adds the debugfs when creating the device but resetting a device will remove the debugfs subtree and subsequent set_driver will not be able to create the files since the debugfs pointer is NULL. Fixes: 2942210 ("vdpa/mlx5: Add debugfs subtree") Signed-off-by: Eli Cohen <[email protected]> v3 -> v4: Fix error flow in setup_driver() Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Acked-by: Jason Wang <[email protected]>
1 parent 9513c55 commit f0417e7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/vdpa/mlx5/net/mlx5_vnet.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2467,10 +2467,11 @@ static int setup_driver(struct mlx5_vdpa_dev *mvdev)
24672467
err = 0;
24682468
goto out;
24692469
}
2470+
mlx5_vdpa_add_debugfs(ndev);
24702471
err = setup_virtqueues(mvdev);
24712472
if (err) {
24722473
mlx5_vdpa_warn(mvdev, "setup_virtqueues\n");
2473-
goto out;
2474+
goto err_setup;
24742475
}
24752476

24762477
err = create_rqt(ndev);
@@ -2500,6 +2501,8 @@ static int setup_driver(struct mlx5_vdpa_dev *mvdev)
25002501
destroy_rqt(ndev);
25012502
err_rqt:
25022503
teardown_virtqueues(ndev);
2504+
err_setup:
2505+
mlx5_vdpa_remove_debugfs(ndev->debugfs);
25032506
out:
25042507
return err;
25052508
}
@@ -2513,6 +2516,8 @@ static void teardown_driver(struct mlx5_vdpa_net *ndev)
25132516
if (!ndev->setup)
25142517
return;
25152518

2519+
mlx5_vdpa_remove_debugfs(ndev->debugfs);
2520+
ndev->debugfs = NULL;
25162521
teardown_steering(ndev);
25172522
destroy_tir(ndev);
25182523
destroy_rqt(ndev);
@@ -3261,7 +3266,6 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
32613266
if (err)
32623267
goto err_reg;
32633268

3264-
mlx5_vdpa_add_debugfs(ndev);
32653269
mgtdev->ndev = ndev;
32663270
return 0;
32673271

0 commit comments

Comments
 (0)