Re: [PATCH] mm: Use BUG_ON instead of if condition followed by BUG

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 24, 2021 at 03:08:49AM +0000, cgel.zte@xxxxxxxxx wrote:
> From: chiminghao <chi.minghao@xxxxxxxxxx>
> 
> Fix the following coccinelle report:
> ./mm/memory_hotplug.c:2210:2-5:
> WARNING  Use BUG_ON instead of if condition followed by BUG.

What coccinelle script is reporting this?

> -	if (try_remove_memory(start, size))
> -		BUG();
> +	BUG_ON(try_remove_memory(start, size));

I really, really, really do not like this.  For functions with
side-effects, this is bad style.  If it's a pure predicate, then
sure, but this is bad.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux