RDMA/rdmavt: Fix error code in rvt_create_qp()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 13 Oct 2021 08:06:45 +0000 (11:06 +0300)
committerJason Gunthorpe <jgg@nvidia.com>
Wed, 13 Oct 2021 16:59:47 +0000 (13:59 -0300)
Return negative -ENOMEM instead of positive ENOMEM.  Returning a postive
value will cause an Oops because it becomes an ERR_PTR() in the
create_qp() function.

Fixes: 514aee660df4 ("RDMA: Globally allocate and release QP memory")
Link: https://lore.kernel.org/r/20211013080645.GD6010@kili
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/sw/rdmavt/qp.c

index 49bdd78..3305f27 100644 (file)
@@ -1223,7 +1223,7 @@ int rvt_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init_attr,
        spin_lock(&rdi->n_qps_lock);
        if (rdi->n_qps_allocated == rdi->dparms.props.max_qp) {
                spin_unlock(&rdi->n_qps_lock);
-               ret = ENOMEM;
+               ret = -ENOMEM;
                goto bail_ip;
        }