linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@kernel.org>,
	John Stultz <john.stultz@linaro.org>,
	Stephen Boyd <sboyd@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>
Subject: [PATCH] time: Mark expected switch fall-throughs
Date: Wed, 23 Jan 2019 02:14:13 -0600	[thread overview]
Message-ID: <20190123081413.GA3949@embeddedor> (raw)

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

This patch fixes the following warnings:

kernel/time/hrtimer.c: In function ‘hrtimer_fixup_activate’:
./include/linux/compiler.h:77:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
 # define unlikely(x) __builtin_expect(!!(x), 0)
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
./include/asm-generic/bug.h:125:2: note: in expansion of macro ‘unlikely’
  unlikely(__ret_warn_on);     \
  ^~~~~~~~
kernel/time/hrtimer.c:366:3: note: in expansion of macro ‘WARN_ON’
   WARN_ON(1);
   ^~~~~~~
kernel/time/hrtimer.c:368:2: note: here
  default:
  ^~~~~~~

kernel/time/timer.c: In function ‘timer_fixup_activate’:
./include/linux/compiler.h:77:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
 # define unlikely(x) __builtin_expect(!!(x), 0)
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
./include/asm-generic/bug.h:125:2: note: in expansion of macro ‘unlikely’
  unlikely(__ret_warn_on);     \
  ^~~~~~~~
kernel/time/timer.c:649:3: note: in expansion of macro ‘WARN_ON’
   WARN_ON(1);
   ^~~~~~~
kernel/time/timer.c:651:2: note: here
  default:
  ^~~~~~~

kernel/time/tick-broadcast.c: In function ‘tick_broadcast_control’:
kernel/time/tick-broadcast.c:377:25: warning: this statement may fall through [-Wimplicit-fallthrough=]
   tick_broadcast_forced = 1;
   ~~~~~~~~~~~~~~~~~~~~~~^~~
kernel/time/tick-broadcast.c:378:2: note: here
  case TICK_BROADCAST_ON:
  ^~~~

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enabling
-Wimplicit-fallthrough.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 kernel/time/hrtimer.c        | 1 +
 kernel/time/tick-broadcast.c | 1 +
 kernel/time/timer.c          | 1 +
 3 files changed, 3 insertions(+)

diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index 0f5f96075110..5fc8c8add815 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -364,6 +364,7 @@ static bool hrtimer_fixup_activate(void *addr, enum debug_obj_state state)
 	switch (state) {
 	case ODEBUG_STATE_ACTIVE:
 		WARN_ON(1);
+		/* fall through */
 
 	default:
 		return false;
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index 803fa67aace9..ee834d4fb814 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -375,6 +375,7 @@ void tick_broadcast_control(enum tick_broadcast_mode mode)
 	switch (mode) {
 	case TICK_BROADCAST_FORCE:
 		tick_broadcast_forced = 1;
+		/* fall through */
 	case TICK_BROADCAST_ON:
 		cpumask_set_cpu(cpu, tick_broadcast_on);
 		if (!cpumask_test_and_set_cpu(cpu, tick_broadcast_mask)) {
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 6eb7cc4b6d52..b1425b7d84d5 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -647,6 +647,7 @@ static bool timer_fixup_activate(void *addr, enum debug_obj_state state)
 
 	case ODEBUG_STATE_ACTIVE:
 		WARN_ON(1);
+		/* fall through */
 
 	default:
 		return false;
-- 
2.20.1


             reply	other threads:[~2019-01-23  8:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-23  8:14 Gustavo A. R. Silva [this message]
2019-01-29 19:13 ` [tip:timers/core] timers: " tip-bot for Gustavo A. R. Silva

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=20190123081413.GA3949@embeddedor \
    --to=gustavo@embeddedor.com \
    --cc=fweisbec@gmail.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=tglx@linutronix.de \
    --subject='Re: [PATCH] time: Mark expected switch fall-throughs' \
    /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

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox