RDMA/mlx5: Delete unreachable code
authorLeon Romanovsky <leonro@mellanox.com>
Mon, 27 Jul 2020 09:57:46 +0000 (12:57 +0300)
committerJason Gunthorpe <jgg@nvidia.com>
Tue, 28 Jul 2020 19:25:37 +0000 (16:25 -0300)
Delete two occurrences of unreachable code discovered by the Coverity.

Link: https://lore.kernel.org/r/20200727095746.495915-1-leon@kernel.org
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/mlx5/main.c
drivers/infiniband/hw/mlx5/qp.c

index b730297..a973008 100644 (file)
@@ -287,9 +287,6 @@ struct mlx5_core_dev *mlx5_ib_get_native_port_mdev(struct mlx5_ib_dev *ibdev,
                *native_port_num = 1;
 
        port = &ibdev->port[ib_port_num - 1];
-       if (!port)
-               return NULL;
-
        spin_lock(&port->mp.mpi_lock);
        mpi = ibdev->port[ib_port_num - 1].mp.mpi;
        if (mpi && !mpi->unaffiliate) {
index 3da8af9..9fbe058 100644 (file)
@@ -4102,9 +4102,9 @@ static int mlx5_ib_modify_dct(struct ib_qp *ibqp, struct ib_qp_attr *attr,
        struct mlx5_ib_qp *qp = to_mqp(ibqp);
        struct mlx5_ib_dev *dev = to_mdev(ibqp->device);
        enum ib_qp_state cur_state, new_state;
-       int err = 0;
        int required = IB_QP_STATE;
        void *dctc;
+       int err;
 
        if (!(attr_mask & IB_QP_STATE))
                return -EINVAL;
@@ -4198,11 +4198,9 @@ static int mlx5_ib_modify_dct(struct ib_qp *ibqp, struct ib_qp_attr *attr,
                mlx5_ib_warn(dev, "Modify DCT: Invalid transition from %d to %d\n", cur_state, new_state);
                return -EINVAL;
        }
-       if (err)
-               qp->state = IB_QPS_ERR;
-       else
-               qp->state = new_state;
-       return err;
+
+       qp->state = new_state;
+       return 0;
 }
 
 int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,