Re: [PATCH] Make WARN_ON/WARN_ON_ONCE no-ops when CONFIG_BUG is off
- From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
- Date: Sat, 15 Dec 2007 12:16:59 +0800
On Fri, Dec 14, 2007 at 12:02:46PM -0600, Matt Mackall wrote:
I added CONFIG_BUG, and I think the current behavior is correct. As
you've noticed, we have to evaluate condition, it may have
side-effects. And if code does:
/* this indicates a driver bug, report and fail gracefully */
if (WARN_ON(val == NULL))
return -EFAULT;
That's exactly the sort of use I had in mind :) I'm actually the
one who added the ability to use WARN_ON inside an if clause.
Just as the case of a BUG_ON, a WARN_ON should never occur in
practice, unless there is a bug which the code is not aware of.
As such we want it to go away completely if CONFIG_BUG is off.
..we surely want it to continue returning -EFAULT, regardless of
whether we log it, no? What use case did you have in mind?
If you're using it for a scenario which is known to actually
occur, then some other mechanism should be chosen in place of
WARN_ON.
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- Re: [PATCH] Make WARN_ON/WARN_ON_ONCE no-ops when CONFIG_BUG is off
- From: Matt Mackall
- Re: [PATCH] Make WARN_ON/WARN_ON_ONCE no-ops when CONFIG_BUG is off
- References:
- [PATCH] Make WARN_ON/WARN_ON_ONCE no-ops when CONFIG_BUG is off
- From: Herbert Xu
- Re: [PATCH] Make WARN_ON/WARN_ON_ONCE no-ops when CONFIG_BUG is off
- From: Matt Mackall
- [PATCH] Make WARN_ON/WARN_ON_ONCE no-ops when CONFIG_BUG is off
- Prev by Date: [PATCH 2.6.24-rc5-mm 3/3] gpiolib: obsolete drivers/i2c/chips/pca9539.c
- Next by Date: Re: Iomega ZIP-100 drive unsupported with jmicron JMB361 chip?
- Previous by thread: Re: [PATCH] Make WARN_ON/WARN_ON_ONCE no-ops when CONFIG_BUG is off
- Next by thread: Re: [PATCH] Make WARN_ON/WARN_ON_ONCE no-ops when CONFIG_BUG is off
- Index(es):
Relevant Pages
|
|