diff options
author | Parav Pandit <parav@mellanox.com> | 2018-03-19 08:59:59 +0300 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-03-19 20:41:40 +0300 |
commit | 6d5b2047fe62ed83a90f0ecdf1cc9b4ae6fcc974 (patch) | |
tree | e5dc4fd30e77f805df720eedd2cec6d8c4728580 /drivers/infiniband/core | |
parent | 958d2c1ba37680b765a089dc374cc199fb61619b (diff) | |
download | linux-6d5b2047fe62ed83a90f0ecdf1cc9b4ae6fcc974.tar.xz |
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>
Diffstat (limited to 'drivers/infiniband/core')
-rw-r--r-- | drivers/infiniband/core/cache.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c index 31def0f2ac49..5b9416af825b 100644 --- a/drivers/infiniband/core/cache.c +++ b/drivers/infiniband/core/cache.c @@ -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); |