From patchwork Mon Sep 10 14:03:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhong jiang X-Patchwork-Id: 10594205 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 69AD914BD for ; Mon, 10 Sep 2018 14:15:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59F3028F92 for ; Mon, 10 Sep 2018 14:15:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4BC3128FCA; Mon, 10 Sep 2018 14:15:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D530728F92 for ; Mon, 10 Sep 2018 14:15:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B3BAC8E0004; Mon, 10 Sep 2018 10:15:34 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id AC2998E0001; Mon, 10 Sep 2018 10:15:34 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9639B8E0004; Mon, 10 Sep 2018 10:15:34 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by kanga.kvack.org (Postfix) with ESMTP id 5C3578E0001 for ; Mon, 10 Sep 2018 10:15:34 -0400 (EDT) Received: by mail-pl1-f200.google.com with SMTP id 2-v6so10072153plc.11 for ; Mon, 10 Sep 2018 07:15:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:mime-version; bh=+woAue+vCOYwqQ7zJlEHfP8iLWHJgfMQ+D2QLUjZdT0=; b=R40pTG4bUxTQlUiUy7oEuO0L8YYAT+m8HmRJbGRXzePr28+bHprrnkfHbOiohU4rBI w5HZoOT0r6pVsxr9FBNBvFdopR+S9Cv4xP68cE/fYlC0FeCBXH/ehUx9aeOmyYMm+bjF M4rWUx5OETDsa+g/4E6K/mTb1VLjB8JG/RmrH8dklE4bPg0s99anD6kul6c39PKlJR6Y EJ0FP0SJw4twqJZkXsBt6f3+jQYI+boCW9G/6ebYGyqqtEqAiu0ZWp0uksh39ZC3hatp 4Mey53oFHhe6l18w4+bgtgNF3ikNULEVJZo3A7bYeOiFc0jGIa0MEwnDuQ5Z5Ppwa/Hh m6dQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of zhongjiang@huawei.com designates 45.249.212.35 as permitted sender) smtp.mailfrom=zhongjiang@huawei.com X-Gm-Message-State: APzg51B0akLka90ByHETyoHB3sFpiw3OmHnZJwtPJNZAUMEn2uOEYQsc XP2z+4GmMzwVpNiFFUY1keLy4L8Gp08R5pAc4SFtyPDyFApYVFE80e7klkhJZJz1Hvp29vyGK2E IiczYInWo4ip5+BP0sIE146XdIbzg3WwyHwCAfNzPVdvsC3eNwAPKfKJP8uGpiH8j6A== X-Received: by 2002:a63:495f:: with SMTP id y31-v6mr22665394pgk.32.1536588934023; Mon, 10 Sep 2018 07:15:34 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYNCeFrQ8yT4hfpd587xnMyFfjglBf6fCeMfKkngtsqW6M36l5dmqDFZqFv6OW+RFhwyO8x X-Received: by 2002:a63:495f:: with SMTP id y31-v6mr22665321pgk.32.1536588933172; Mon, 10 Sep 2018 07:15:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536588933; cv=none; d=google.com; s=arc-20160816; b=1EWtHoRzjEvmjUVliiRy5ONsCXDFZdkj4wYzsaoqhmUW++CmMGFDx7tELU+qt4AvNM TEW7bjd5nkn44AtFd+yOzog+gWfQVF8nybM7vHwwIcX+pp2N+i7zzEyhkLYHsZkIcXq5 DwQpRjXCjx/3yvY1mddGoA/iLgKkb5euzBEfsLfwLlaZJaKKoeysEiPEcl/K0Qbkp5Oc 4L2ol/SRvzqQjqk2NT5GtNwjh24Iti5fR/eHMa7cfiehf5AniFI4/7kvCdB+RVhPejY/ x8Xp1VERahAUMVUSlsSXSGVlm0bjZsBgaUR4SmX3FgmFc2CAkrqZ9uL8NQPlgLdmVRrN GuDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:message-id:date:subject:cc:to:from; bh=+woAue+vCOYwqQ7zJlEHfP8iLWHJgfMQ+D2QLUjZdT0=; b=EXZqolWQxZPKvOsneGgwRUrSdpWd4ucS/vhiyD1BfBTMvkVxN8jVkT4h5s0dSSsso+ tzWDhbEtRnt4IAwaakQtv/VPR49MmWV4oaxPIlQ9SyC3X+FeRB123aH3u49EUXIs+Lp7 hJ3QHh1TuCv5wYka7WG5N6KW80MP1FkCzzqhYSvwIhpvGmYyF4RJZGXGzuLI+eM5vdTK mKa84CAJ9CzpFZV1wMXJD41EJg89wzjnB3Rvh95gwJrSUMf3Xz3WWXFyxP/DwEhHesfq 2JKHAXaQJWgqUAvtXZ39JvLoAjIEfX9QbCHkanv1BxM+ho/x+gpIcX6eOxF8w0DdeHap X9lg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of zhongjiang@huawei.com designates 45.249.212.35 as permitted sender) smtp.mailfrom=zhongjiang@huawei.com Received: from huawei.com (szxga07-in.huawei.com. [45.249.212.35]) by mx.google.com with ESMTPS id h23-v6si15708874pgv.356.2018.09.10.07.15.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Sep 2018 07:15:33 -0700 (PDT) Received-SPF: pass (google.com: domain of zhongjiang@huawei.com designates 45.249.212.35 as permitted sender) client-ip=45.249.212.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of zhongjiang@huawei.com designates 45.249.212.35 as permitted sender) smtp.mailfrom=zhongjiang@huawei.com Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id F29A7D3BC25DE; Mon, 10 Sep 2018 22:15:28 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.399.0; Mon, 10 Sep 2018 22:15:30 +0800 From: zhong jiang To: CC: , , , , Subject: [PATCH] mm: Use BUG_ON directly instead of a if condition followed by BUG Date: Mon, 10 Sep 2018 22:03:17 +0800 Message-ID: <1536588197-22115-1-git-send-email-zhongjiang@huawei.com> X-Mailer: git-send-email 1.7.12.4 MIME-Version: 1.0 X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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");