linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: Use BUG_ON directly instead of a if condition followed by BUG
@ 2018-09-10 14:03 zhong jiang
  2018-09-10 14:27 ` Michal Hocko
  2018-09-10 19:54 ` kbuild test robot
  0 siblings, 2 replies; 3+ messages in thread
From: zhong jiang @ 2018-09-10 14:03 UTC (permalink / raw)
  To: akpm; +Cc: mhocko, pasha.tatashin, dan.j.williams, linux-mm, linux-kernel

The if condition can be removed if we use BUG_ON directly.
The issule is detected with the help of Coccinelle.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 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 38d94b7..280b26c 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1888,8 +1888,7 @@ void __ref remove_memory(int nid, u64 start, u64 size)
 	 */
 	ret = walk_memory_range(PFN_DOWN(start), PFN_UP(start + size - 1), NULL,
 				check_memblock_offlined_cb);
-	if (ret)
-		BUG();
+	BUG(ret);
 
 	/* remove memmap entry */
 	firmware_map_remove(start, start + size, "System RAM");
-- 
1.7.12.4


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

end of thread, other threads:[~2018-09-10 19:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-10 14:03 [PATCH] mm: Use BUG_ON directly instead of a if condition followed by BUG zhong jiang
2018-09-10 14:27 ` Michal Hocko
2018-09-10 19:54 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).