Skip to content

Commit 531f64f

Browse files
committed
posix-timers: Convert abuses of BUG_ON to WARN_ON
The posix cpu timers code makes a heavy use of BUG_ON() but none of these concern fatal issues that require to stop the machine. So let's just warn the user when some internal state slips out of our hands. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Kosaki Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Andrew Morton <akpm@linux-foundation.org>
1 parent e73d84e commit 531f64f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

kernel/posix-cpu-timers.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ static int posix_cpu_timer_del(struct k_itimer *timer)
395395
* We raced with the reaping of the task.
396396
* The deletion should have cleared us off the list.
397397
*/
398-
BUG_ON(!list_empty(&timer->it.cpu.entry));
398+
WARN_ON_ONCE(!list_empty(&timer->it.cpu.entry));
399399
} else {
400400
if (timer->it.cpu.firing)
401401
ret = TIMER_RETRY;
@@ -640,7 +640,7 @@ static int posix_cpu_timer_set(struct k_itimer *timer, int timer_flags,
640640
/*
641641
* Disarm any old timer after extracting its expiry time.
642642
*/
643-
BUG_ON(!irqs_disabled());
643+
WARN_ON_ONCE(!irqs_disabled());
644644

645645
ret = 0;
646646
old_incr = timer->it.cpu.incr;
@@ -1061,7 +1061,7 @@ void posix_cpu_timer_schedule(struct k_itimer *timer)
10611061
/*
10621062
* Now re-arm for the new expiry time.
10631063
*/
1064-
BUG_ON(!irqs_disabled());
1064+
WARN_ON_ONCE(!irqs_disabled());
10651065
arm_timer(timer);
10661066
unlock_task_sighand(p, &flags);
10671067

@@ -1150,7 +1150,7 @@ void run_posix_cpu_timers(struct task_struct *tsk)
11501150
struct k_itimer *timer, *next;
11511151
unsigned long flags;
11521152

1153-
BUG_ON(!irqs_disabled());
1153+
WARN_ON_ONCE(!irqs_disabled());
11541154

11551155
/*
11561156
* The fast path checks that there are no expired thread or thread
@@ -1217,7 +1217,7 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clock_idx,
12171217
{
12181218
unsigned long long now;
12191219

1220-
BUG_ON(clock_idx == CPUCLOCK_SCHED);
1220+
WARN_ON_ONCE(clock_idx == CPUCLOCK_SCHED);
12211221
cpu_timer_sample_group(clock_idx, tsk, &now);
12221222

12231223
if (oldval) {

0 commit comments

Comments
 (0)