linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5/5] time: Add missing annotation for __run_timer()
@ 2020-01-20 22:43 Jules Irenge
  2020-01-22 14:54 ` [tip: timers/core] hrtimer: Add missing sparse " tip-bot2 for Jules Irenge
  0 siblings, 1 reply; 2+ messages in thread
From: Jules Irenge @ 2020-01-20 22:43 UTC (permalink / raw)
  To: tglx; +Cc: linux-kernel, boqun.feng, Jules Irenge

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@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [tip: timers/core] hrtimer: Add missing sparse annotation for __run_timer()
  2020-01-20 22:43 [PATCH 5/5] time: Add missing annotation for __run_timer() Jules Irenge
@ 2020-01-22 14:54 ` tip-bot2 for Jules Irenge
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot2 for Jules Irenge @ 2020-01-22 14:54 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Jules Irenge, Thomas Gleixner, x86, LKML

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 <jbi.octave@gmail.com>
AuthorDate:    Mon, 20 Jan 2020 22:43:47 
Committer:     Thomas Gleixner <tglx@linutronix.de>
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.

Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20200120224347.51843-1-jbi.octave@gmail.com

---
 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 d8b62f9..3a609e7 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;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-22 14:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-20 22:43 [PATCH 5/5] time: Add missing annotation for __run_timer() Jules Irenge
2020-01-22 14:54 ` [tip: timers/core] hrtimer: Add missing sparse " tip-bot2 for Jules Irenge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).