From: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Dennis Dalessandro
<dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Jason Gunthorpe
<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>,
Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: [rdma-next 1/8] RDMA/mlx4: Properly annotate link layer variable
Date: Tue, 15 Aug 2017 12:14:24 +0300 [thread overview]
Message-ID: <20170815091431.12822-2-leon@kernel.org> (raw)
In-Reply-To: <20170815091431.12822-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
The rdma_port_get_link_layer() returns enum rdma_link_layer as
a return value, hence it is better to store the return value in
specially annotated variable and not in int.
Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
drivers/infiniband/hw/mlx4/qp.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index 2874d8790570..8c6ccc392d87 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -2732,19 +2732,17 @@ enum {
static int _mlx4_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
int attr_mask, struct ib_udata *udata)
{
+ enum rdma_link_layer ll = IB_LINK_LAYER_UNSPECIFIED;
struct mlx4_ib_dev *dev = to_mdev(ibqp->device);
struct mlx4_ib_qp *qp = to_mqp(ibqp);
enum ib_qp_state cur_state, new_state;
int err = -EINVAL;
- int ll;
mutex_lock(&qp->mutex);
cur_state = attr_mask & IB_QP_CUR_STATE ? attr->cur_qp_state : qp->state;
new_state = attr_mask & IB_QP_STATE ? attr->qp_state : cur_state;
- if (cur_state == new_state && cur_state == IB_QPS_RESET) {
- ll = IB_LINK_LAYER_UNSPECIFIED;
- } else {
+ if (cur_state != new_state || cur_state != IB_QPS_RESET) {
int port = attr_mask & IB_QP_PORT ? attr->port_num : qp->port;
ll = rdma_port_get_link_layer(&dev->ib_dev, port);
}
--
2.14.0
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-08-15 9:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-15 9:14 [pull request][rdma-next 0/8] Export device and port properties Leon Romanovsky
[not found] ` <20170815091431.12822-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-08-15 9:14 ` Leon Romanovsky [this message]
2017-08-15 9:14 ` [rdma-next 2/8] RDMA/core: Export device capabilities flags Leon Romanovsky
2017-08-15 9:14 ` [rdma-next 3/8] RDMA/core: Provide node type flags Leon Romanovsky
2017-08-15 9:14 ` [rdma-next 4/8] RDMA/core: Move port capabilities to UAPI Leon Romanovsky
2017-08-15 9:14 ` [rdma-next 5/8] RDMA/core: Move port state to UAPI and rename it to be link Leon Romanovsky
2017-08-15 9:14 ` [rdma-next 6/8] RDMA/core: Add physical link state information to the UAPI Leon Romanovsky
2017-08-15 9:14 ` [rdma-next 7/8] RDMA/nes: Remove zeroed parameter from port query callback Leon Romanovsky
2017-08-15 9:14 ` [rdma-next 8/8] RDMA: Use defines instead of hard coded value for phys_state Leon Romanovsky
[not found] ` <20170815091431.12822-9-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-08-23 14:59 ` Boyer, Andrew
[not found] ` <D5C31047.1DB0A%Andrew.Boyer-mb1K0bWo544@public.gmane.org>
2017-08-23 15:29 ` Leon Romanovsky
[not found] ` <20170823152915.GQ1724-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-08-24 12:56 ` Boyer, Andrew
[not found] ` <D5C444A5.1DC28%Andrew.Boyer-mb1K0bWo544@public.gmane.org>
2017-08-24 13:24 ` Leon Romanovsky
2017-08-23 16:27 ` [pull request][rdma-next 0/8] Export device and port properties Leon Romanovsky
[not found] ` <20170823162718.GS1724-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-08-24 20:07 ` Doug Ledford
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=20170815091431.12822-2-leon@kernel.org \
--to=leon-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
--cc=leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/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).