summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParav Pandit <parav@mellanox.com>2018-08-28 15:08:42 +0300
committerJason Gunthorpe <jgg@mellanox.com>2018-09-06 22:45:38 +0300
commitf7b65d9bf2db0e4b319c0676900c6c25398a449f (patch)
tree36f7fd44ecb1f62c53fdc7396a05ce1ac40e7b47
parent93688ddbe1da1ead030b210dadc5a8cfbff95849 (diff)
downloadlinux-f7b65d9bf2db0e4b319c0676900c6c25398a449f.tar.xz
RDMA/core: Use simplified list_for_each
While traversing client_data_list in following conditions, linked list is only read, no elements of the list are removed. Therefore, use list_for_each_entry(), instead of list_for_each_safe(). Signed-off-by: Parav Pandit <parav@mellanox.com> Reviewed-by: Daniel Jurgens <danielj@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
-rw-r--r--drivers/infiniband/core/device.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 9bc5ba2f488e..559fbe6a97c2 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -587,13 +587,12 @@ void ib_unregister_device(struct ib_device *device)
down_write(&lists_rwsem);
list_del(&device->core_list);
spin_lock_irqsave(&device->client_data_lock, flags);
- list_for_each_entry_safe(context, tmp, &device->client_data_list, list)
+ list_for_each_entry(context, &device->client_data_list, list)
context->going_down = true;
spin_unlock_irqrestore(&device->client_data_lock, flags);
downgrade_write(&lists_rwsem);
- list_for_each_entry_safe(context, tmp, &device->client_data_list,
- list) {
+ list_for_each_entry(context, &device->client_data_list, list) {
if (context->client->remove)
context->client->remove(device, context->data);
}
@@ -663,7 +662,7 @@ EXPORT_SYMBOL(ib_register_client);
*/
void ib_unregister_client(struct ib_client *client)
{
- struct ib_client_data *context, *tmp;
+ struct ib_client_data *context;
struct ib_device *device;
unsigned long flags;
@@ -678,7 +677,7 @@ void ib_unregister_client(struct ib_client *client)
down_write(&lists_rwsem);
spin_lock_irqsave(&device->client_data_lock, flags);
- list_for_each_entry_safe(context, tmp, &device->client_data_list, list)
+ list_for_each_entry(context, &device->client_data_list, list)
if (context->client == client) {
context->going_down = true;
found_context = context;