RDMA/ocrdma: Replace BUG() with BUG_ON()
authorssh10 <mayhs11saini@gmail.com>
Sat, 24 Dec 2016 16:20:06 +0000 (21:50 +0530)
committerDoug Ledford <dledford@redhat.com>
Thu, 12 Jan 2017 17:21:52 +0000 (12:21 -0500)
Replace BUG() with BUG_ON() using coccinelle

Signed-off-by: Shyam Saini <mayhs11saini@gmail.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c

index 6af44f8db3d5499d46c584ac7fb386c1263f033d..e06ad72509636414414eb393076d425fe7e32c9e 100644 (file)
@@ -1170,8 +1170,7 @@ int ocrdma_destroy_cq(struct ib_cq *ibcq)
 
        dev->cq_tbl[cq->id] = NULL;
        indx = ocrdma_get_eq_table_index(dev, cq->eqn);
-       if (indx == -EINVAL)
-               BUG();
+       BUG_ON(indx == -EINVAL);
 
        eq = &dev->eq_tbl[indx];
        irq = ocrdma_get_irq(dev, eq);
@@ -1741,8 +1740,7 @@ static void ocrdma_discard_cqes(struct ocrdma_qp *qp, struct ocrdma_cq *cq)
                                wqe_idx = (le32_to_cpu(cqe->rq.buftag_qpn) >>
                                        OCRDMA_CQE_BUFTAG_SHIFT) &
                                        qp->srq->rq.max_wqe_idx;
-                               if (wqe_idx < 1)
-                                       BUG();
+                               BUG_ON(wqe_idx < 1);
                                spin_lock_irqsave(&qp->srq->q_lock, flags);
                                ocrdma_hwq_inc_tail(&qp->srq->rq);
                                ocrdma_srq_toggle_bit(qp->srq, wqe_idx - 1);
@@ -2388,15 +2386,13 @@ static int ocrdma_srq_get_idx(struct ocrdma_srq *srq)
                if (srq->idx_bit_fields[row]) {
                        indx = ffs(srq->idx_bit_fields[row]);
                        indx = (row * 32) + (indx - 1);
-                       if (indx >= srq->rq.max_cnt)
-                               BUG();
+                       BUG_ON(indx >= srq->rq.max_cnt);
                        ocrdma_srq_toggle_bit(srq, indx);
                        break;
                }
        }
 
-       if (row == srq->bit_fields_len)
-               BUG();
+       BUG_ON(row == srq->bit_fields_len);
        return indx + 1; /* Use from index 1 */
 }
 
@@ -2754,8 +2750,7 @@ static void ocrdma_update_free_srq_cqe(struct ib_wc *ibwc,
        srq = get_ocrdma_srq(qp->ibqp.srq);
        wqe_idx = (le32_to_cpu(cqe->rq.buftag_qpn) >>
                OCRDMA_CQE_BUFTAG_SHIFT) & srq->rq.max_wqe_idx;
-       if (wqe_idx < 1)
-               BUG();
+       BUG_ON(wqe_idx < 1);
 
        ibwc->wr_id = srq->rqe_wr_id_tbl[wqe_idx];
        spin_lock_irqsave(&srq->q_lock, flags);