aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/device.c
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@mellanox.com>2019-01-12 02:42:42 +0000
committerJason Gunthorpe <jgg@mellanox.com>2019-01-18 13:05:58 -0700
commit344684e6d02ff21ff2fce8cf1b2de3fd3cafcac7 (patch)
tree6782ef8c0446bb99955672b189510917b8cf6ee2 /drivers/infiniband/core/device.c
parentRDMA/hns: RDMA/hns: Assign rq head pointer when enable rq record db (diff)
downloadlinux-dev-344684e6d02ff21ff2fce8cf1b2de3fd3cafcac7.tar.xz
linux-dev-344684e6d02ff21ff2fce8cf1b2de3fd3cafcac7.zip
RDMA/device: Use __ib_device_get_by_name() in ib_device_rename()
No reason to open code this loop. Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Diffstat (limited to 'drivers/infiniband/core/device.c')
-rw-r--r--drivers/infiniband/core/device.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index f8180cf1a004..4a9aa6d10c5e 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -183,18 +183,15 @@ static struct ib_device *__ib_device_get_by_name(const char *name)
int ib_device_rename(struct ib_device *ibdev, const char *name)
{
- struct ib_device *device;
int ret = 0;
if (!strcmp(name, dev_name(&ibdev->dev)))
return ret;
mutex_lock(&device_mutex);
- list_for_each_entry(device, &device_list, core_list) {
- if (!strcmp(name, dev_name(&device->dev))) {
- ret = -EEXIST;
- goto out;
- }
+ if (__ib_device_get_by_name(name)) {
+ ret = -EEXIST;
+ goto out;
}
ret = device_rename(&ibdev->dev, name);