[PATCH 05/10] softirq: Replace BUG() after if statement with BUG_ON

From: Jules Irenge
Date: Fri Mar 27 2020 - 17:24:32 EST


Coccinelle reports a warning tasklet_action_common()

WARNING: Use BUG_ON instead of if condition followed by BUG

To fix this, BUG() is replaced by BUG_ON() with the recommended suggestion

Signed-off-by: Jules Irenge <jbi.octave@xxxxxxxxx>
---
kernel/softirq.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel/softirq.c b/kernel/softirq.c
index 0427a86743a4..8a8f6ea0ff0a 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -517,9 +517,8 @@ static void tasklet_action_common(struct softirq_action *a,

if (tasklet_trylock(t)) {
if (!atomic_read(&t->count)) {
- if (!test_and_clear_bit(TASKLET_STATE_SCHED,
- &t->state))
- BUG();
+ BUG_ON(!test_and_clear_bit(TASKLET_STATE_SCHED,
+ &t->state));
t->func(t->data);
tasklet_unlock(t);
continue;
--
2.25.1