Skip to content

Commit ccaa492

Browse files
bjdooks-ctKAGA-KOKO
authored andcommitted
hrtimer: Add missing sparse annotations to hrtimer locking
Sparse warns about lock imbalance vs. the hrtimer_base lock due to missing sparse annotations: kernel/time/hrtimer.c:175:33: warning: context imbalance in 'lock_hrtimer_base' - wrong count at exit kernel/time/hrtimer.c:1301:28: warning: context imbalance in 'hrtimer_start_range_ns' - unexpected unlock kernel/time/hrtimer.c:1336:28: warning: context imbalance in 'hrtimer_try_to_cancel' - unexpected unlock kernel/time/hrtimer.c:1457:9: warning: context imbalance in '__hrtimer_get_remaining' - unexpected unlock Add the annotations to the relevant functions. Signed-off-by: Ben Dooks <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 2951580 commit ccaa492

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

kernel/time/hrtimer.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ static inline bool is_migration_base(struct hrtimer_clock_base *base)
164164
static
165165
struct hrtimer_clock_base *lock_hrtimer_base(const struct hrtimer *timer,
166166
unsigned long *flags)
167+
__acquires(&timer->base->lock)
167168
{
168169
struct hrtimer_clock_base *base;
169170

@@ -280,6 +281,7 @@ static inline bool is_migration_base(struct hrtimer_clock_base *base)
280281

281282
static inline struct hrtimer_clock_base *
282283
lock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags)
284+
__acquires(&timer->base->cpu_base->lock)
283285
{
284286
struct hrtimer_clock_base *base = timer->base;
285287

@@ -1013,6 +1015,7 @@ void hrtimers_resume_local(void)
10131015
*/
10141016
static inline
10151017
void unlock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags)
1018+
__releases(&timer->base->cpu_base->lock)
10161019
{
10171020
raw_spin_unlock_irqrestore(&timer->base->cpu_base->lock, *flags);
10181021
}

0 commit comments

Comments
 (0)