linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: cgel.zte@gmail.com, akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	chiminghao <chi.minghao@zte.com.cn>,
	Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH] mm: Use BUG_ON instead of if condition followed by BUG
Date: Wed, 24 Nov 2021 12:10:49 +0100	[thread overview]
Message-ID: <f106fc33-4935-6f07-3e93-35bfd0d2434d@redhat.com> (raw)
In-Reply-To: <20211124030849.34998-1-chi.minghao@zte.com.cn>

On 24.11.21 04:08, cgel.zte@gmail.com wrote:
> From: chiminghao <chi.minghao@zte.com.cn>

"mm/memory_hotplug: Use BUG_ON instead of if condition followed by BUG"

Would be better

> 
> Fix the following coccinelle report:
> ./mm/memory_hotplug.c:2210:2-5:
> WARNING  Use BUG_ON instead of if condition followed by BUG.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: chiminghao <chi.minghao@zte.com.cn>
> ---
>  mm/memory_hotplug.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 3de7933e5302..aecb12bb7513 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -2212,8 +2212,7 @@ void __remove_memory(u64 start, u64 size)
>  	 * trigger BUG() if some memory is not offlined prior to calling this
>  	 * function
>  	 */
> -	if (try_remove_memory(start, size))
> -		BUG();
> +	BUG_ON(try_remove_memory(start, size));
>  }
>  
>  /*
> 

Acked-by: David Hildenbrand <david@redhat.com>


-- 
Thanks,

David / dhildenb



  reply	other threads:[~2021-11-24 11:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24  3:08 cgel.zte
2021-11-24 11:10 ` David Hildenbrand [this message]
2021-11-24 13:23 ` Matthew Wilcox
2021-11-24 22:27   ` Andrew Morton
2021-11-24 22:45     ` John Hubbard
2021-11-25  3:32       ` Matthew Wilcox
2021-11-25  5:29         ` John Hubbard
2021-11-25  0:00   ` Matthew Wilcox
2021-11-27 18:05     ` Julia Lawall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f106fc33-4935-6f07-3e93-35bfd0d2434d@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgel.zte@gmail.com \
    --cc=chi.minghao@zte.com.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=zealci@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox