From: zhong jiang <zhongjiang@huawei.com>
To: <akpm@linux-foundation.org>
Cc: <mhocko@suse.com>, <pasha.tatashin@oracle.com>,
<dan.j.williams@intel.com>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH] mm: Use BUG_ON directly instead of a if condition followed by BUG
Date: Mon, 10 Sep 2018 22:03:17 +0800 [thread overview]
Message-ID: <1536588197-22115-1-git-send-email-zhongjiang@huawei.com> (raw)
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
next reply other threads:[~2018-09-10 14:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-10 14:03 zhong jiang [this message]
2018-09-10 14:27 ` [PATCH] mm: Use BUG_ON directly instead of a if condition followed by BUG Michal Hocko
2018-09-10 19:54 ` kbuild test robot
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=1536588197-22115-1-git-send-email-zhongjiang@huawei.com \
--to=zhongjiang@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=dan.j.williams@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=pasha.tatashin@oracle.com \
/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;
as well as URLs for NNTP newsgroup(s).