Skip to contentSkip to conversation

iaf_packet: use BUG_ON

PATCH In review Himangi Saraogi 2 participants 2 messages Jul 8, 2014

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

PATCH 1/1 iaf_packet: use BUG_ON

Use BUG_ON(x) rather than if(x) BUG();

The semantic patch that fixes this problem is as follows:

// <smpl>
@@ identifier x; @@
-if (x) BUG();
+BUG_ON(x);
// </smpl>

---
To send to: "David S. Miller" <[email protected]>,[email protected],[email protected]

 net/packet/af_packet.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/packet/af_packet.c +1 -2
index b85c67c..cda8552 100644
@@ -551,8 +551,7 @@ static void prb_setup_retire_blk_timer(struct packet_sock *po, int tx_ring)
 {
 	struct tpacket_kbdq_core *pkc;
 
-	if (tx_ring)
-		BUG();
+	BUG_ON(tx_ring);
 
 	pkc = tx_ring ? GET_PBDQC_FROM_RB(&po->tx_ring) :
 			GET_PBDQC_FROM_RB(&po->rx_ring);
Signature · 1 line
1.9.1
maintainer
#1 lore raw

From: Himangi Saraogi <[email protected]>
Date: Wed, 9 Jul 2014 03:50:23 +0530

Quoted 10 lines

Use BUG_ON(x) rather than if(x) BUG();

The semantic patch that fixes this problem is as follows:

// <smpl>
@@ identifier x; @@

(quoted diff) +1 -1
-if (x) BUG();
+BUG_ON(x);

// </smpl>

Quoted 2 lines

Please repost this with a proper subject line, correcting "iaf_packet".