mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-22 14:59:52 +07:00
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>
This commit is contained in:
parent
de77503a59
commit
344684e6d0
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user