From: Dan Carpenter <dan.carpenter@oracle.com>
To: Doug Ledford <dledford@redhat.com>, Ram Amrani <Ram.Amrani@cavium.com>
Cc: Sean Hefty <sean.hefty@intel.com>,
Hal Rosenstock <hal.rosenstock@gmail.com>,
Rajesh Borundia <rajesh.borundia@cavium.com>,
linux-rdma@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] qedr: Unlock on error in qedr_post_send()
Date: Tue, 15 Nov 2016 09:51:00 +0000 [thread overview]
Message-ID: <20161115095059.GB15424@mwanda> (raw)
If "wr" is NULL then we return without unlocking. I added an unlock
label and changed the direct returns to gotos.
Fixes: afa0e13be754 ("qedr: Add support for data path")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
index a615142..01d05b0 100644
--- a/drivers/infiniband/hw/qedr/verbs.c
+++ b/drivers/infiniband/hw/qedr/verbs.c
@@ -2973,17 +2973,18 @@ int qedr_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
if ((qp->state = QED_ROCE_QP_STATE_RESET) ||
(qp->state = QED_ROCE_QP_STATE_ERR)) {
- spin_unlock_irqrestore(&qp->q_lock, flags);
*bad_wr = wr;
DP_DEBUG(dev, QEDR_MSG_CQ,
"QP in wrong state! QP icid=0x%x state %d\n",
qp->icid, qp->state);
- return -EINVAL;
+ rc = -EINVAL;
+ goto unlock;
}
if (!wr) {
DP_ERR(dev, "Got an empty post send.\n");
- return -EINVAL;
+ rc = -EINVAL;
+ goto unlock;
}
while (wr) {
@@ -3012,6 +3013,7 @@ int qedr_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
/* Make sure write sticks */
mmiowb();
+unlock:
spin_unlock_irqrestore(&qp->q_lock, flags);
return rc;
next reply other threads:[~2016-11-15 9:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-15 9:51 Dan Carpenter [this message]
2016-11-15 10:28 ` [patch] qedr: Unlock on error in qedr_post_send() Amrani, Ram
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=20161115095059.GB15424@mwanda \
--to=dan.carpenter@oracle.com \
--cc=Ram.Amrani@cavium.com \
--cc=dledford@redhat.com \
--cc=hal.rosenstock@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=rajesh.borundia@cavium.com \
--cc=sean.hefty@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