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

From: Jules Irenge
Date: Mon Jan 20 2020 - 17:44:05 EST


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.

Signed-off-by: Jules Irenge <jbi.octave@xxxxxxxxx>
---
kernel/time/hrtimer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index 8de90ea31280..3e94ea58b18d 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -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;
--
2.24.1