]> git.baikalelectronics.ru Git - kernel.git/commit
net/mlx5: Fix debugfs cleanup in the device init/remove flow
authorJack Morgenstein <jackm@dev.mellanox.co.il>
Tue, 7 Aug 2018 06:59:03 +0000 (09:59 +0300)
committerSaeed Mahameed <saeedm@mellanox.com>
Thu, 6 Sep 2018 00:08:33 +0000 (17:08 -0700)
commita2a0e0394c4eb3c4a92d7722303d96eb8346320e
treea8118979964e07e150dd2f88b9d3aad2fe785c28
parenta487188be5a572294647b6b1000687cc44ce44c1
net/mlx5: Fix debugfs cleanup in the device init/remove flow

When initializing the device (procedure init_one), the driver
calls mlx5_pci_init to perform pci initialization. As part of this
initialization, mlx5_pci_init creates a debugfs directory.
If this creation fails, init_one aborts, returning failure to
the caller (which is the probe method caller).

The main reason for such a failure to occur is if the debugfs
directory already exists. This can happen if the last time
mlx5_pci_close was called, debugfs_remove (silently) failed due
to the debugfs directory not being empty.

Guarantee that such a debugfs_remove failure will not occur by
instead calling debugfs_remove_recursive in procedure mlx5_pci_close.

Fixes: a80765cc8d4f ("net/mlx5: Split the load/unload flow into hardware and software flows")
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/main.c