Skip to contentSkip to conversation

time: Add missing annotation for __run_timer()

PATCH Applied Jules Irenge 2 participants 2 messages Jan 20, 2020 – Jan 22, 2020 High-resolution timers, timer wheel, clockevents

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 5/5 time: Add missing annotation for __run_timer()

Sparse reports a warning at __run_hrtimer()

|warning: context imbalance in __run_hrtimer() - unexpected unlock

To fix this, a must_hold() annotation is added. Given that __run_hrtimer() requires lock to be held This not only fixes the warning
but also improves on the readability of the code.

---
 kernel/time/hrtimer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/hrtimer.c +1 -1
index 8de90ea31280..3e94ea58b18d 100644
@@ -1477,7 +1477,7 @@ EXPORT_SYMBOL_GPL(hrtimer_active);
 static void __run_hrtimer(struct hrtimer_cpu_base *cpu_base,
 			  struct hrtimer_clock_base *base,
 			  struct hrtimer *timer, ktime_t *now,
-			  unsigned long flags)
+			  unsigned long flags) __must_hold(&cpu_base->lock)
 {
 	enum hrtimer_restart (*fn)(struct hrtimer *);
 	int restart;
Signature · 1 line
2.24.1
merge bot Applied
#1 lore raw

[tip: timers/core] hrtimer: Add missing sparse annotation for __run_timer()

The following commit has been merged into the timers/core branch of tip:

The following commit has been merged into the timers/core branch of tip:

Commit-ID:     eb5a4d0a9ee976008d1add75e3d64545399e80a3
Gitweb:        https://git.kernel.org/tip/eb5a4d0a9ee976008d1add75e3d64545399e80a3
Author:        Jules Irenge <[email protected]>
AuthorDate:    Mon, 20 Jan 2020 22:43:47 
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Wed, 22 Jan 2020 15:50:11 +01:00

hrtimer: Add missing sparse annotation for __run_timer()

Sparse reports a warning at __run_hrtimer()
|warning: context imbalance in __run_hrtimer() - unexpected unlock

Add the missing must_hold() annotation.

---
 kernel/time/hrtimer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/hrtimer.c +1 -1
index d8b62f9..3a609e7 100644
@@ -1477,7 +1477,7 @@ EXPORT_SYMBOL_GPL(hrtimer_active);
 static void __run_hrtimer(struct hrtimer_cpu_base *cpu_base,
 			  struct hrtimer_clock_base *base,
 			  struct hrtimer *timer, ktime_t *now,
-			  unsigned long flags)
+			  unsigned long flags) __must_hold(&cpu_base->lock)
 {
 	enum hrtimer_restart (*fn)(struct hrtimer *);
 	int restart;