diff options
author | Parav Pandit <parav@mellanox.com> | 2018-03-19 01:59:59 -0400 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-03-19 13:41:40 -0400 |
commit | 6d5b2047fe62ed83a90f0ecdf1cc9b4ae6fcc974 (patch) | |
tree | e5dc4fd30e77f805df720eedd2cec6d8c4728580 /drivers/infiniband/core/cache.c | |
parent | 958d2c1ba37680b765a089dc374cc199fb61619b (diff) |
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/cache.c')
-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, | |||
937 | unsigned long flags; | 937 | unsigned long flags; |
938 | int p; | 938 | int p; |
939 | 939 | ||
940 | if (port_num < rdma_start_port(device) || | 940 | if (!rdma_is_port_valid(device, port_num)) |
941 | port_num > rdma_end_port(device)) | ||
942 | return -EINVAL; | 941 | return -EINVAL; |
943 | 942 | ||
944 | p = port_num - rdma_start_port(device); | 943 | p = port_num - rdma_start_port(device); |
@@ -1048,7 +1047,7 @@ int ib_get_cached_port_state(struct ib_device *device, | |||
1048 | unsigned long flags; | 1047 | unsigned long flags; |
1049 | int ret = 0; | 1048 | int ret = 0; |
1050 | 1049 | ||
1051 | if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) | 1050 | if (!rdma_is_port_valid(device, port_num)) |
1052 | return -EINVAL; | 1051 | return -EINVAL; |
1053 | 1052 | ||
1054 | read_lock_irqsave(&device->cache.lock, flags); | 1053 | read_lock_irqsave(&device->cache.lock, flags); |