diff options
author | Arnd Bergmann <arnd@arndb.de> | 2018-04-09 08:23:33 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2018-04-10 03:18:04 -0400 |
commit | bbe9a70a478129f3f9b2003415d0c36afcea210f (patch) | |
tree | e69c1d48fbe29e0e7d1d11270966e78f75b177c3 | |
parent | 792ccb457ade4107ad9f1892cb23b78c13a10fb1 (diff) |
tick-sched: avoid a maybe-uninitialized warning
The use of bitfields seems to confuse gcc, leading to a false-positive
warning in all compiler versions:
kernel/time/tick-sched.c: In function 'tick_nohz_idle_exit':
kernel/time/tick-sched.c:538:2: error: 'now' may be used uninitialized in this function [-Werror=maybe-uninitialized]
This introduces a temporary variable to track the flags so gcc
doesn't have to evaluate twice, eliminating the code path that
leads to the warning.
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85301
Fixes: 1cae544d42d2 ("nohz: Gather tick_sched booleans under a common flag field")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | kernel/time/tick-sched.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 956831cf6cfb..e35a6fced00c 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
@@ -1134,6 +1134,7 @@ void tick_nohz_idle_restart_tick(void) | |||
1134 | void tick_nohz_idle_exit(void) | 1134 | void tick_nohz_idle_exit(void) |
1135 | { | 1135 | { |
1136 | struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched); | 1136 | struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched); |
1137 | bool idle_active, tick_stopped; | ||
1137 | ktime_t now; | 1138 | ktime_t now; |
1138 | 1139 | ||
1139 | local_irq_disable(); | 1140 | local_irq_disable(); |
@@ -1142,14 +1143,16 @@ void tick_nohz_idle_exit(void) | |||
1142 | WARN_ON_ONCE(ts->timer_expires_base); | 1143 | WARN_ON_ONCE(ts->timer_expires_base); |
1143 | 1144 | ||
1144 | ts->inidle = 0; | 1145 | ts->inidle = 0; |
1146 | idle_active = ts->idle_active; | ||
1147 | tick_stopped = ts->tick_stopped; | ||
1145 | 1148 | ||
1146 | if (ts->idle_active || ts->tick_stopped) | 1149 | if (idle_active || tick_stopped) |
1147 | now = ktime_get(); | 1150 | now = ktime_get(); |
1148 | 1151 | ||
1149 | if (ts->idle_active) | 1152 | if (idle_active) |
1150 | tick_nohz_stop_idle(ts, now); | 1153 | tick_nohz_stop_idle(ts, now); |
1151 | 1154 | ||
1152 | if (ts->tick_stopped) | 1155 | if (tick_stopped) |
1153 | __tick_nohz_idle_restart_tick(ts, now); | 1156 | __tick_nohz_idle_restart_tick(ts, now); |
1154 | 1157 | ||
1155 | local_irq_enable(); | 1158 | local_irq_enable(); |