aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/core/device.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index b448e0b2b6b4..b58319642014 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -569,10 +569,7 @@ int ib_query_port(struct ib_device *device,
569 u8 port_num, 569 u8 port_num,
570 struct ib_port_attr *port_attr) 570 struct ib_port_attr *port_attr)
571{ 571{
572 if (device->node_type == RDMA_NODE_IB_SWITCH) { 572 if (port_num < start_port(device) || port_num > end_port(device))
573 if (port_num)
574 return -EINVAL;
575 } else if (port_num < 1 || port_num > device->phys_port_cnt)
576 return -EINVAL; 573 return -EINVAL;
577 574
578 return device->query_port(device, port_num, port_attr); 575 return device->query_port(device, port_num, port_attr);
@@ -644,10 +641,7 @@ int ib_modify_port(struct ib_device *device,
644 u8 port_num, int port_modify_mask, 641 u8 port_num, int port_modify_mask,
645 struct ib_port_modify *port_modify) 642 struct ib_port_modify *port_modify)
646{ 643{
647 if (device->node_type == RDMA_NODE_IB_SWITCH) { 644 if (port_num < start_port(device) || port_num > end_port(device))
648 if (port_num)
649 return -EINVAL;
650 } else if (port_num < 1 || port_num > device->phys_port_cnt)
651 return -EINVAL; 645 return -EINVAL;
652 646
653 return device->modify_port(device, port_num, port_modify_mask, 647 return device->modify_port(device, port_num, port_modify_mask,