mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nicholas Mc Guire <der.herr@hofr.at>
To: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Nick Piggin <npiggin@suse.de>,
	linux-kernel@vger.kernel.org,
	Nicholas Mc Guire <der.herr@hofr.at>
Subject: [PATCH] sched/core: switch to BUG_ON()
Date: Mon, 27 Mar 2017 09:40:46 +0200	[thread overview]
Message-ID: <1490600446-1774-1-git-send-email-der.herr@hofr.at> (raw)

Use BUG_ON() rather than an explicit if followed by BUG().

Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
---

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

             reply	other threads:[~2017-03-27  7:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27  7:40 Nicholas Mc Guire [this message]
2017-03-27  8:24 ` Peter Zijlstra
2017-03-27  9:10   ` Nicholas Mc Guire

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=1490600446-1774-1-git-send-email-der.herr@hofr.at \
    --to=der.herr@hofr.at \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=npiggin@suse.de \
    --cc=peterz@infradead.org \
    --cc=rusty@rustcorp.com.au \
    /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

all inboxes | Powered by JetHome®