mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-29 07:34:06 +08:00
IB/core: Use rdma_is_port_valid()
Use rdma_is_port_valid() which performs port validity check instead of open coding the same check. Signed-off-by: Parav Pandit <parav@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
parent
958d2c1ba3
commit
6d5b2047fe
@ -937,8 +937,7 @@ int ib_get_cached_subnet_prefix(struct ib_device *device,
|
||||
unsigned long flags;
|
||||
int p;
|
||||
|
||||
if (port_num < rdma_start_port(device) ||
|
||||
port_num > rdma_end_port(device))
|
||||
if (!rdma_is_port_valid(device, port_num))
|
||||
return -EINVAL;
|
||||
|
||||
p = port_num - rdma_start_port(device);
|
||||
@ -1048,7 +1047,7 @@ int ib_get_cached_port_state(struct ib_device *device,
|
||||
unsigned long flags;
|
||||
int ret = 0;
|
||||
|
||||
if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device))
|
||||
if (!rdma_is_port_valid(device, port_num))
|
||||
return -EINVAL;
|
||||
|
||||
read_lock_irqsave(&device->cache.lock, flags);
|
||||
|
Loading…
Reference in New Issue
Block a user