From patchwork Wed Nov 24 03:08:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: CGEL X-Patchwork-Id: 12635903 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 127A6C433F5 for ; Wed, 24 Nov 2021 03:09:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 903EF6B0078; Tue, 23 Nov 2021 22:09:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8B21F6B007B; Tue, 23 Nov 2021 22:09:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 752E16B007D; Tue, 23 Nov 2021 22:09:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0038.hostedemail.com [216.40.44.38]) by kanga.kvack.org (Postfix) with ESMTP id 690586B0078 for ; Tue, 23 Nov 2021 22:09:09 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 335D2824C442 for ; Wed, 24 Nov 2021 03:08:59 +0000 (UTC) X-FDA: 78842341998.18.A49D863 Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) by imf07.hostedemail.com (Postfix) with ESMTP id C559210002C3 for ; Wed, 24 Nov 2021 03:08:55 +0000 (UTC) Received: by mail-qt1-f173.google.com with SMTP id a2so1289896qtx.11 for ; Tue, 23 Nov 2021 19:08:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=BK/4cFthG4GJZS5AoKb8+SGtl+JeDjxoi5HKvVoykfE=; b=ZJb492LZe89rR2WaruNnhZ/39u+ri0ho//jl7PjlGu5Im4kGo1Wn6q8ZZJsGtGCWI5 X6k/Vq+S/Y7DrXWQ9MJR5hrqpu0X8DKrDK+q6Vvv04TIDuj3z0gJWpWTIgFBReYbMYsG ENHOwWrS/MfyoAnGuTYBJgOoI6Rvd87MGb5/mOa+5tyeobp3tAcowUfq64lr+M+d62lg VnmUPay0qlZoS2X1BGVvCNbs//iHsZg8XgTwWUbxGwQc3sD/MJI99jzVlQ2cGbSg32FG viqwPKvW0QuAcbAxKDJdXdjozFKXVvBNXTufsuC5yYtjCK+1Nyd5WXdjdj4lPKmD3Kao /GQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=BK/4cFthG4GJZS5AoKb8+SGtl+JeDjxoi5HKvVoykfE=; b=t/TwOdMOHfsgF4ZXKh5S0HoDGb9G4YTHWoTj2TnpZds2PtU0Z53qfKLEoq/rGvyQ8m B8Hn5e5/tgdX2tAftrVpbKX9tpliSOOs7J1vFMqsM1cDQaO53Iw738WcqkaEa5FcLiuk NmO1/hbpikUJrbtW8IgrpfXr/rFyHeARth83zWsOC3VqOA27AEvsWgi8nJQ6b+EyvSOl MEkQkdQfAXiQc7gpYCdYz60AZOyQehewdo+b9D8gO+2ULMoY90tfBl8a7vk/DMuSO34D iGSgIRe+4OXgM8pc8GL0N6t+Sa/XE+Sye7P0qlf/yHEWjIDIpa+y+nXPzxUID+avFa4k uTKA== X-Gm-Message-State: AOAM531KW3velwWi828dW5UiSdDD1XvB9whUAuCQdX5pFFQmWRB+106f h5b6HtlHTPJ/YsxaoZDncLQ= X-Google-Smtp-Source: ABdhPJym6t493UbXUooiE7EnMqyNJdAJRxfOGzuIU2Qx01ZWNBkJpVFJ//H085l9Thw8DPPk9z3X0g== X-Received: by 2002:a05:622a:1901:: with SMTP id w1mr3035938qtc.134.1637723338163; Tue, 23 Nov 2021 19:08:58 -0800 (PST) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id o10sm7216884qtx.33.2021.11.23.19.08.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 19:08:57 -0800 (PST) From: cgel.zte@gmail.com X-Google-Original-From: chi.minghao@zte.com.cn To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, chiminghao , Zeal Robot Subject: [PATCH] mm: Use BUG_ON instead of if condition followed by BUG Date: Wed, 24 Nov 2021 03:08:49 +0000 Message-Id: <20211124030849.34998-1-chi.minghao@zte.com.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: C559210002C3 X-Stat-Signature: xs1kwj1xq73ebsp67uiqswfrgyanfdaw Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ZJb492LZ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf07.hostedemail.com: domain of cgel.zte@gmail.com designates 209.85.160.173 as permitted sender) smtp.mailfrom=cgel.zte@gmail.com X-HE-Tag: 1637723335-984432 X-Bogosity: Ham, tests=bogofilter, spamicity=0.001213, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: chiminghao 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 Signed-off-by: chiminghao Acked-by: David Hildenbrand --- 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)); } /*