Messages in this thread | | | Date | Tue, 24 Oct 2017 17:48:42 +0900 (KST) | Subject | Re: [PATCH] net: xfrm_user: use BUG_ON instead of if condition followed by BUG | From | David Miller <> |
| |
From: Herbert Xu <herbert@gondor.apana.org.au> Date: Tue, 24 Oct 2017 11:53:20 +0800
> No your patch makes it worse. The original construct makes it > clear that the conditional is real code and not just some debugging > aid. > > With your patch, real code is now inside BUG_ON.
This discussion has happened before.
But I'll explain the conclusion here for your benefit.
BUG_ON() is a statement and everything inside of it will always execute.
BUG_ON() is always preferred because it allows arch specific code to pass the conditional result properly into inline asm and builtins for optimal code generation.
| |