[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200423120434.19304-1-sudipm.mukherjee@gmail.com>
Date: Thu, 23 Apr 2020 13:04:34 +0100
From: Sudip Mukherjee <sudipm.mukherjee@...il.com>
To: Dennis Dalessandro <dennis.dalessandro@...el.com>,
Mike Marciniszyn <mike.marciniszyn@...el.com>,
Doug Ledford <dledford@...hat.com>,
Jason Gunthorpe <jgg@...pe.ca>
Cc: linux-kernel@...r.kernel.org, linux-rdma@...r.kernel.org,
Sudip Mukherjee <sudipm.mukherjee@...il.com>
Subject: [PATCH] IB/rdmavt: return proper error code
The function rvt_create_mmap_info() can return either NULL or an error
in ERR_PTR(). Check properly for both the error type and return the
error code accordingly.
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@...il.com>
---
drivers/infiniband/sw/rdmavt/cq.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/infiniband/sw/rdmavt/cq.c b/drivers/infiniband/sw/rdmavt/cq.c
index 5724cbbe38b1..326b1e6b362d 100644
--- a/drivers/infiniband/sw/rdmavt/cq.c
+++ b/drivers/infiniband/sw/rdmavt/cq.c
@@ -248,8 +248,8 @@ int rvt_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
*/
if (udata && udata->outlen >= sizeof(__u64)) {
cq->ip = rvt_create_mmap_info(rdi, sz, udata, u_wc);
- if (!cq->ip) {
- err = -ENOMEM;
+ if (IS_ERR_OR_NULL(cq->ip)) {
+ err = cq->ip ? PTR_ERR(cq->ip) : -ENOMEM;
goto bail_wc;
}
--
2.11.0
Powered by blists - more mailing lists