Skip to contentSkip to conversation

usb: use BUG_ON() instead of BUG()

PATCH In review Geyslan G. Bem 2 participants 2 messages Dec 2, 2015 – Dec 7, 2015 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: use BUG_ON() instead of BUG()

Replace BUG() with BUG_ON().

Caught by coccinelle.

---
 drivers/usb/host/oxu210hp-hcd.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/usb/host/oxu210hp-hcd.c +3 -5
index 1f139d8..bc74aca 100644
@@ -394,8 +394,7 @@ static void ehci_quiesce(struct oxu_hcd *oxu)
 	u32	temp;
 
 #ifdef DEBUG
-	if (!HC_IS_RUNNING(oxu_to_hcd(oxu)->state))
-		BUG();
+	BUG_ON(!HC_IS_RUNNING(oxu_to_hcd(oxu)->state));
 #endif
 
 	/* wait for any schedule enables/disables to take effect */
@@ -1709,9 +1708,8 @@ static void start_unlink_async(struct oxu_hcd *oxu, struct ehci_qh *qh)
 
 #ifdef DEBUG
 	assert_spin_locked(&oxu->lock);
-	if (oxu->reclaim || (qh->qh_state != QH_STATE_LINKED
-				&& qh->qh_state != QH_STATE_UNLINK_WAIT))
-		BUG();
+	BUG_ON(oxu->reclaim || (qh->qh_state != QH_STATE_LINKED
+				&& qh->qh_state != QH_STATE_UNLINK_WAIT));
 #endif
 
 	/* stop async schedule right now? */
Signature · 1 line
2.6.3
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Geyslan G. Bem

Replace BUG() with BUG_ON().

Caught by coccinelle.

I would mention the path to the .cocci script, but other than that:

Quoted 35 lines
---
 drivers/usb/host/oxu210hp-hcd.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/usb/host/oxu210hp-hcd.c +3 -6
index 1f139d8..bc74aca 100644
@@ -394,8 +394,7 @@ static void ehci_quiesce(struct oxu_hcd *oxu)
        u32     temp;
 
 #ifdef DEBUG
-       if (!HC_IS_RUNNING(oxu_to_hcd(oxu)->state))
-               BUG();
+       BUG_ON(!HC_IS_RUNNING(oxu_to_hcd(oxu)->state));
 #endif
 
        /* wait for any schedule enables/disables to take effect */
@@ -1709,9 +1708,8 @@ static void start_unlink_async(struct oxu_hcd *oxu, struct ehci_qh *qh)
 
 #ifdef DEBUG
        assert_spin_locked(&oxu->lock);
-       if (oxu->reclaim || (qh->qh_state != QH_STATE_LINKED
-                               && qh->qh_state != QH_STATE_UNLINK_WAIT))
-               BUG();
+       BUG_ON(oxu->reclaim || (qh->qh_state != QH_STATE_LINKED
+                               && qh->qh_state != QH_STATE_UNLINK_WAIT));
 #endif
 
        /* stop async schedule right now? */
--

2.6.3

Signature · 1 line
Peter