@@ -838,11 +838,11 @@ static void irdma_puda_free_qp(struct irdma_puda_rsrc *rsrc)
}
ret = irdma_sc_qp_destroy(&rsrc->qp, 0, false, true, true);
- if (ret)
+ if (ret) {
ibdev_dbg(to_ibdev(dev),
"PUDA: error puda qp destroy wqe, status = %d\n",
ret);
- if (!ret) {
+ } else {
ret = irdma_sc_poll_for_cqp_op_done(dev->cqp, IRDMA_CQP_OP_DESTROY_QP,
&compl_info);
if (ret)
@@ -869,9 +869,9 @@ static void irdma_puda_free_cq(struct irdma_puda_rsrc *rsrc)
}
ret = irdma_sc_cq_destroy(&rsrc->cq, 0, true);
- if (ret)
+ if (ret) {
ibdev_dbg(to_ibdev(dev), "PUDA: error ieq cq destroy\n");
- if (!ret) {
+ } else {
ret = irdma_sc_poll_for_cqp_op_done(dev->cqp, IRDMA_CQP_OP_DESTROY_CQ,
&compl_info);
if (ret)
@@ -304,13 +304,11 @@ static int send_leave_to_wire(struct mcast_group *group, u8 join_state)
ret = send_mad_to_wire(group->demux, (struct ib_mad *)&mad);
if (ret)
group->state = MCAST_IDLE;
-
/* set timeout handler */
- if (!ret) {
+ else
/* calls mlx4_ib_mcg_timeout_handler */
queue_delayed_work(group->demux->mcg_wq, &group->timeout_work,
msecs_to_jiffies(MAD_TIMEOUT_MS));
- }
return ret;
}
@@ -561,8 +559,9 @@ static void mlx4_ib_mcg_timeout_handler(struct work_struct *work)
return;
}
mutex_lock(&group->lock);
- } else
+ } else {
mcg_warn_group(group, "DRIVER BUG\n");
+ }
} else if (group->state == MCAST_LEAVE_SENT) {
if (group->rec.scope_join_state & 0xf)
group->rec.scope_join_state &= 0xf0;
@@ -571,8 +570,9 @@ static void mlx4_ib_mcg_timeout_handler(struct work_struct *work)
if (release_group(group, 1))
return;
mutex_lock(&group->lock);
- } else
+ } else {
mcg_warn_group(group, "invalid state %s\n", get_state_string(group->state));
+ }
group->state = MCAST_IDLE;
atomic_inc(&group->refcount);
if (!queue_work(group->demux->mcg_wq, &group->work))
@@ -632,7 +632,7 @@ static int handle_join_req(struct mcast_group *group, u8 join_mask,
kfree(req);
ref = 1;
group->state = group->prev_state;
- } else
+ } else {
group->state = MCAST_JOIN_SENT;
}
@@ -681,10 +681,12 @@ static void mlx4_ib_mcg_work_handler(struct work_struct *work)
list_del(&req->func_list);
kfree(req);
++rc;
- } else
+ } else {
mcg_warn_group(group, "no request for failed join\n");
- } else if (method == IB_SA_METHOD_DELETE_RESP && group->demux->flushing)
+ }
+ } else if (method == IB_SA_METHOD_DELETE_RESP && group->demux->flushing) {
++rc;
+ }
} else {
u8 resp_join_state;
u8 cur_join_state;
@@ -697,8 +699,9 @@ static void mlx4_ib_mcg_work_handler(struct work_struct *work)
/* successfull join */
if (!cur_join_state && resp_join_state)
--rc;
- } else if (!resp_join_state)
- ++rc;
+ } else if (!resp_join_state) {
+ ++rc;
+ }
memcpy(&group->rec, group->response_sa_mad.data, sizeof group->rec);
}
group->state = MCAST_IDLE;
@@ -730,8 +733,9 @@ static void mlx4_ib_mcg_work_handler(struct work_struct *work)
if (send_leave_to_wire(group, req_join_state)) {
group->state = group->prev_state;
++rc;
- } else
+ } else {
group->state = MCAST_LEAVE_SENT;
+ }
}
}
@@ -898,8 +902,9 @@ int mlx4_ib_mcg_demux_handler(struct ib_device *ibdev, int port, int slave,
__be64 tid = mad->mad_hdr.tid;
*(u8 *)(&tid) = (u8)slave; /* in group we kept the modified TID */
group = search_relocate_mgid0_group(ctx, tid, &rec->mgid);
- } else
+ } else {
group = NULL;
+ }
}
if (!group)
Replace `if (!ret)` with `else` for simplification and fix the unbalanced curly brackets. Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com> --- drivers/infiniband/hw/irdma/puda.c | 8 ++++---- drivers/infiniband/hw/mlx4/mcg.c | 29 +++++++++++++++++------------ 2 files changed, 21 insertions(+), 16 deletions(-)