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 <[email protected]>
---
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
Jules,
Jules Irenge <[email protected]> writes:
> 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
Well, the suggestion is wrong to begin with. The suggestion should be:
Is this BUG() actually necessary and is this the only way to deal
with this problem?
Only if that question can be answered with yes, then the recommended
replacement is ok.
BUG() is the last resort and each and every instance wants to be looked
at and not mechanically changed to some 'better' version of it.
Thanks,
tglx