Re: Can BUG() also be used "safely" in interrupts?

Tommy Reynolds (reynolds@redhat.com)
Fri, 17 May 2002 09:27:40 -0500


Uttered "Ingo Oeser" <ingo.oeser@informatik.tu-chemnitz.de>, spoke thus:

> I have a routine to be used in an ISR or BH, where I like to use
> BUG(), to flag real bugs the caller produces, if he uses it with
> wrong arguments (namely: check for asserted interrupts according
> to a mask and flag an BUG(), if the mask is bogus).
>
> So can BUG() be used in an ISR or BH?

BUG() is overkill here, since it breaks all existing spin locks trying to get
the error message printed by the kernel. Instead, why not just:

printk( KERN_WARN "spurious interrupt from my device\n" );

like everyone else does? Keep in mind that if you are sharing an interrupt
vector, each and every interrupt handler gets called for each and every
interrupt, so having the device driver check that the device to which it is
attached is really generating an interrupt is simple good form.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/