linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: Use BUG_ON instead of if condition followed by BUG
@ 2021-11-24  3:08 cgel.zte
  2021-11-24 11:10 ` David Hildenbrand
  2021-11-24 13:23 ` Matthew Wilcox
  0 siblings, 2 replies; 9+ messages in thread
From: cgel.zte @ 2021-11-24  3:08 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, linux-kernel, chiminghao, Zeal Robot

From: chiminghao <chi.minghao@zte.com.cn>

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));
 }
 
 /*
-- 
2.25.1



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-11-27 18:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-24  3:08 [PATCH] mm: Use BUG_ON instead of if condition followed by BUG cgel.zte
2021-11-24 11:10 ` David Hildenbrand
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox