Skip to contentSkip to conversation

infiniband: hw: ocrdma: Replace BUG() with BUG_ON()

PATCH Applied Shyam Saini 2 participants 2 messages Dec 24, 2016 – Jan 12, 2017 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 infiniband: hw: ocrdma: Replace BUG() with BUG_ON()

Replace BUG() with BUG_ON() using coccinelle

---
 drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/infiniband/hw/ocrdma/ocrdma_hw.c +4 -9
index 9a30520..ac11c56 100644
@@ -664,8 +664,7 @@ static void ocrdma_process_qpcat_error(struct ocrdma_dev *dev,
 	enum ib_qp_state new_ib_qps = IB_QPS_ERR;
 	enum ib_qp_state old_ib_qps;
 
-	if (qp == NULL)
-		BUG();
+	BUG_ON(qp == NULL);
 	ocrdma_qp_state_change(qp, new_ib_qps, &old_ib_qps);
 }
 
@@ -964,8 +963,7 @@ static void ocrdma_qp_cq_handler(struct ocrdma_dev *dev, u16 cq_idx)
 	unsigned long flags;
 	struct ocrdma_cq *cq;
 
-	if (cq_idx >= OCRDMA_MAX_CQ)
-		BUG();
+	BUG_ON(cq_idx >= OCRDMA_MAX_CQ);
 
 	cq = dev->cq_tbl[cq_idx];
 	if (cq == NULL)
@@ -1116,9 +1114,7 @@ static int ocrdma_nonemb_mbx_cmd(struct ocrdma_dev *dev, struct ocrdma_mqe *mqe,
 	int status;
 	struct ocrdma_mbx_rsp *rsp = payload_va;
 
-	if ((mqe->hdr.spcl_sge_cnt_emb & OCRDMA_MQE_HDR_EMB_MASK) >>
-				OCRDMA_MQE_HDR_EMB_SHIFT)
-		BUG();
+	BUG_ON((mqe->hdr.spcl_sge_cnt_emb & OCRDMA_MQE_HDR_EMB_MASK) >> OCRDMA_MQE_HDR_EMB_SHIFT);
 
 	status = ocrdma_mbx_cmd(dev, mqe);
 	if (!status)
@@ -1773,8 +1769,7 @@ static void ocrdma_unbind_eq(struct ocrdma_dev *dev, u16 eq_id)
 
 	mutex_lock(&dev->dev_lock);
 	i = ocrdma_get_eq_table_index(dev, eq_id);
-	if (i == -EINVAL)
-		BUG();
+	BUG_ON(i == -EINVAL);
 	dev->eq_tbl[i].cq_cnt -= 1;
 	mutex_unlock(&dev->dev_lock);
 }
Signature · 6 lines
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html