RDMA core layer already make sure port is valid, no need to check it here
again.
For the pkey validation this depends on commit 
b3ac5742fead ("RDMA/core:
Validate port number in query_pkey verb")
Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
Acked-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
        int ext_active_speed;
        int err = -ENOMEM;
 
-       if (port < 1 || port > dev->num_ports) {
-               mlx5_ib_warn(dev, "invalid port number %d\n", port);
-               return -EINVAL;
-       }
-
        in_mad  = kzalloc(sizeof(*in_mad), GFP_KERNEL);
        out_mad = kmalloc(sizeof(*out_mad), GFP_KERNEL);
        if (!in_mad || !out_mad)
 
 
        /* props being zeroed by the caller, avoid zeroing it here */
        dev = get_ocrdma_dev(ibdev);
-       if (port > 1) {
-               pr_err("%s(%d) invalid_port=0x%x\n", __func__,
-                      dev->id, port);
-               return -EINVAL;
-       }
        netdev = dev->nic_info.netdev;
        if (netif_running(netdev) && netif_oper_up(netdev)) {
                port_state = IB_PORT_ACTIVE;
 int ocrdma_modify_port(struct ib_device *ibdev, u8 port, int mask,
                       struct ib_port_modify *props)
 {
-       struct ocrdma_dev *dev;
-
-       dev = get_ocrdma_dev(ibdev);
-       if (port > 1) {
-               pr_err("%s(%d) invalid_port=0x%x\n", __func__, dev->id, port);
-               return -EINVAL;
-       }
        return 0;
 }
 
 
        struct qed_rdma_port *rdma_port;
 
        dev = get_qedr_dev(ibdev);
-       if (port > 1) {
-               DP_ERR(dev, "invalid_port=0x%x\n", port);
-               return -EINVAL;
-       }
 
        if (!dev->rdma_ctx) {
                DP_ERR(dev, "rdma_ctx is NULL\n");
 int qedr_modify_port(struct ib_device *ibdev, u8 port, int mask,
                     struct ib_port_modify *props)
 {
-       struct qedr_dev *dev;
-
-       dev = get_qedr_dev(ibdev);
-       if (port > 1) {
-               DP_ERR(dev, "invalid_port=0x%x\n", port);
-               return -EINVAL;
-       }
-
        return 0;
 }
 
 
 {
        struct rxe_dev *rxe = to_rdev(dev);
        struct rxe_port *port;
-       int rc = -EINVAL;
-
-       if (unlikely(port_num != 1)) {
-               pr_warn("invalid port_number %d\n", port_num);
-               goto out;
-       }
+       int rc;
 
        port = &rxe->port;
 
 
        mutex_unlock(&rxe->usdev_lock);
 
-out:
        return rc;
 }
 
        struct rxe_dev *rxe = to_rdev(device);
        struct rxe_port *port;
 
-       if (unlikely(port_num != 1)) {
-               dev_warn(device->dev.parent, "invalid port_num = %d\n",
-                        port_num);
-               goto err1;
-       }
-
        port = &rxe->port;
 
        if (unlikely(index >= port->attr.pkey_tbl_len)) {
        struct rxe_dev *rxe = to_rdev(dev);
        struct rxe_port *port;
 
-       if (unlikely(port_num != 1)) {
-               pr_warn("invalid port_num = %d\n", port_num);
-               goto err1;
-       }
-
        port = &rxe->port;
 
        port->attr.port_cap_flags |= attr->set_port_cap_mask;
                port->attr.qkey_viol_cntr = 0;
 
        return 0;
-
-err1:
-       return -EINVAL;
 }
 
 static enum rdma_link_layer rxe_get_link_layer(struct ib_device *dev,