diff options
author | Parav Pandit <parav@mellanox.com> | 2019-02-13 20:23:03 +0300 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2019-02-16 07:42:02 +0300 |
commit | e155755e53804e721c8ce99474cc9c65eb8e8bc2 (patch) | |
tree | 871d2204600ebcb8299ee10cc95bce81ac03d156 /drivers/infiniband/core/sysfs.c | |
parent | cfe876d8e6b0491170d44c8040c518b121957104 (diff) | |
download | linux-e155755e53804e721c8ce99474cc9c65eb8e8bc2.tar.xz |
RDMA/core: Use simpler device_del() instead of device_unregister()
Instead of holding extra reference using get_device() that
device_unregister() releases, simplify it as below.
device_add() balances with device_del(). device_initialize() balances
with put_device(), always via ib_dealloc_device().
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/core/sysfs.c')
-rw-r--r-- | drivers/infiniband/core/sysfs.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index c75692802da8..e04f111fe406 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c @@ -1351,15 +1351,12 @@ err: void ib_device_unregister_sysfs(struct ib_device *device) { - /* Hold device until ib_dealloc_device() */ - get_device(&device->dev); - free_port_list_attributes(device); if (device->hw_stats) { kfree(device->hw_stats); free_hsag(&device->dev.kobj, device->hw_stats_ag); } - - device_unregister(&device->dev); + /* Balances with device_add */ + device_del(&device->dev); } |