]> git.baikalelectronics.ru Git - kernel.git/commitdiff
RDMA/mlx4: Properly annotate link layer variable
authorLeon Romanovsky <leonro@mellanox.com>
Thu, 17 Aug 2017 12:50:54 +0000 (15:50 +0300)
committerDoug Ledford <dledford@redhat.com>
Thu, 24 Aug 2017 20:44:48 +0000 (16:44 -0400)
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@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/mlx4/qp.c

index 1ac148ddb250865f74ab37b98169b45908a52f8f..2747abde2ea8bd26da6a6b497b63e304679d47f2 100644 (file)
@@ -2725,19 +2725,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);
        }