From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: Dennis Dalessandro <dennis.dalessandro@intel.com>,
Mike Marciniszyn <mike.marciniszyn@intel.com>,
Doug Ledford <dledford@redhat.com>,
Jason Gunthorpe <jgg@ziepe.ca>
Cc: linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Subject: [PATCH] IB/rdmavt: return proper error code
Date: Thu, 23 Apr 2020 13:04:34 +0100 [thread overview]
Message-ID: <20200423120434.19304-1-sudipm.mukherjee@gmail.com> (raw)
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@gmail.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
next reply other threads:[~2020-04-23 12:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-23 12:04 Sudip Mukherjee [this message]
2020-04-23 14:09 ` [PATCH] IB/rdmavt: return proper error code Jason Gunthorpe
2020-04-24 12:27 ` Dennis Dalessandro
2020-04-24 13:50 ` Marciniszyn, Mike
2020-04-24 14:00 ` Jason Gunthorpe
2020-04-23 12:48 Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200423120434.19304-1-sudipm.mukherjee@gmail.com \
--to=sudipm.mukherjee@gmail.com \
--cc=dennis.dalessandro@intel.com \
--cc=dledford@redhat.com \
--cc=jgg@ziepe.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mike.marciniszyn@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).