From: Michal Hocko <mhocko@kernel.org>
To: zhong jiang <zhongjiang@huawei.com>
Cc: akpm@linux-foundation.org, pasha.tatashin@oracle.com,
dan.j.williams@intel.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: Use BUG_ON directly instead of a if condition followed by BUG
Date: Mon, 10 Sep 2018 16:27:48 +0200 [thread overview]
Message-ID: <20180910142748.GK10951@dhcp22.suse.cz> (raw)
In-Reply-To: <1536588197-22115-1-git-send-email-zhongjiang@huawei.com>
On Mon 10-09-18 22:03:17, zhong jiang wrote:
> The if condition can be removed if we use BUG_ON directly.
> The issule is detected with the help of Coccinelle.
typo here
Is this really worth changing? If anything I would really love to see
the BUG_ON going away rather than make a cosmetic changes to it.
> 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
>
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2018-09-10 14:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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=20180910142748.GK10951@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=dan.j.williams@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pasha.tatashin@oracle.com \
--cc=zhongjiang@huawei.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).