IB/mlx5: Fix an error code in __mlx5_ib_modify_qp()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 6 Mar 2018 10:00:31 +0000 (13:00 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Wed, 7 Mar 2018 03:08:39 +0000 (20:08 -0700)
"err" is either zero or possibly uninitialized here.  It should be
-EINVAL.

Fixes: 427c1e7bcd7e ("{IB, net}/mlx5: Move the modify QP operation table to mlx5_ib")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/mlx5/qp.c

index e8d7eaf0670ca5aa109c934e1f09bf0020302a57..36197fbac63acef7c5557c74e5b0351f23d9a7c6 100644 (file)
@@ -3100,8 +3100,10 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp,
                goto out;
 
        if (mlx5_cur >= MLX5_QP_NUM_STATE || mlx5_new >= MLX5_QP_NUM_STATE ||
-           !optab[mlx5_cur][mlx5_new])
+           !optab[mlx5_cur][mlx5_new]) {
+               err = -EINVAL;
                goto out;
+       }
 
        op = optab[mlx5_cur][mlx5_new];
        optpar = ib_mask_to_mlx5_opt(attr_mask);