Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752005AbdC0Hlt (ORCPT ); Mon, 27 Mar 2017 03:41:49 -0400 Received: from www.osadl.org ([62.245.132.105]:41807 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751607AbdC0Hll (ORCPT ); Mon, 27 Mar 2017 03:41:41 -0400 From: Nicholas Mc Guire To: Ingo Molnar Cc: Peter Zijlstra , Rusty Russell , Nick Piggin , linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH] sched/core: switch to BUG_ON() Date: Mon, 27 Mar 2017 09:40:46 +0200 Message-Id: <1490600446-1774-1-git-send-email-der.herr@hofr.at> X-Mailer: git-send-email 2.1.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1115 Lines: 36 Use BUG_ON() rather than an explicit if followed by BUG(). Signed-off-by: Nicholas Mc Guire --- Found by coccinelle: bugon.cocci ./kernel/sched/core.c:5913:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG. There is one checkpatch.pl warning but thats a false positive. To panik() when there is no core to run init on sounds resonable. Patch was compile-tested with: x86_64_defconfig (implies CONFIG_SMP=y) (some unrelated sparse warnings) Patch is against 4.11-rc4 (localversion-next is next-20170327) kernel/sched/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index ac88348..b732c16 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5909,8 +5909,8 @@ void __init sched_init_smp(void) mutex_unlock(&sched_domains_mutex); /* Move init over to a non-isolated CPU */ - if (set_cpus_allowed_ptr(current, non_isolated_cpus) < 0) - BUG(); + BUG_ON(set_cpus_allowed_ptr(current, non_isolated_cpus) < 0); + sched_init_granularity(); free_cpumask_var(non_isolated_cpus); -- 2.1.4