Skip to contentSkip to conversation

BUG_ON() Conversion in kernel/signal.c

PATCH New Eric Sesterhenn / snakebyte 1 participant 1 message Jan 30, 2006 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 5/6 BUG_ON() Conversion in kernel/signal.c

hi,

this changes if() BUG(); constructs to BUG_ON() which is cleaner, contains unlikely() and can better optimized away.

kernel/signal.c renamed from kernel/signal.c.orig +5 -10
@@ -355,10 +355,8 @@ void __exit_signal(struct task_struct *t
 	struct signal_struct * sig = tsk->signal;
 	struct sighand_struct * sighand;
 
-	if (!sig)
-		BUG();
-	if (!atomic_read(&sig->count))
-		BUG();
+	BUG_ON(!sig);
+	BUG_ON(!atomic_read(&sig->count));
 	rcu_read_lock();
 	sighand = rcu_dereference(tsk->sighand);
 	spin_lock(&sighand->siglock);
@@ -875,8 +873,7 @@ specific_send_sig_info(int sig, struct s
 {
 	int ret = 0;
 
-	if (!irqs_disabled())
-		BUG();
+	BUG_ON(!irqs_disabled());
 	assert_spin_locked(&t->sighand->siglock);
 
 	/* Short-circuit ignored signals.  */
@@ -1464,8 +1461,7 @@ retry:
 		 * If an SI_TIMER entry is already queue just increment
 		 * the overrun count.
 		 */
-		if (q->info.si_code != SI_TIMER)
-			BUG();
+		BUG_ON(q->info.si_code != SI_TIMER);
 		q->info.si_overrun++;
 		goto out;
 	}
@@ -1513,8 +1509,7 @@ send_group_sigqueue(int sig, struct sigq
 		 * the overrun count.  Other uses should not try to
 		 * send the signal multiple times.
 		 */
-		if (q->info.si_code != SI_TIMER)
-			BUG();
+		BUG_ON(q->info.si_code != SI_TIMER);
 		q->info.si_overrun++;
 		goto out;
 	} 

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors