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

From: Thomas Gleixner
Date: Sat Mar 28 2020 - 07:22:16 EST


Jules,

Jules Irenge <jbi.octave@xxxxxxxxx> 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