Re: BUG_ON(x) instead of if (x) BUG() in mm/page_alloc,swap_state.c

Andrew Morton (akpm@zip.com.au)
Mon, 01 Jul 2002 10:40:17 -0700


Lightweight patch manager wrote:
>
> This replaces if(x) BUG() with BUG_ON(x) where necessarry, at least in
> mm/page_alloc.c and mm/swap_state.c

Thanks - I'll add to my pile.

> ...
> - if (!nr_pages--)
> - BUG();
> + BUG_ON(!nr_pages--)

Except for this chunk. It's best to avoid putting statements
with side-effects inside BUG_ON(). If someone wants to build
a super-small kernel with a no-op BUG_ON() then code such as the
above will cause it to fail.

It'll probably fail anyway, but hey - may as well try.

-
-
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/