From: Jules Irenge <jbi.octave@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: boqun.feng@gmail.com, Jules Irenge <jbi.octave@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] time: Add missing annotation to lock_hrtimer_base()
Date: Fri, 24 Jan 2020 20:12:21 +0000 [thread overview]
Message-ID: <31c31ca2d78d9368d38e1a5909bc0c9a7be5dc98.1579893447.git.jbi.octave@gmail.com> (raw)
In-Reply-To: <cover.1579893447.git.jbi.octave@gmail.com>
Sparse reports a warning at lock_hrtimer_base()
|warning: context imbalance in lock_hrtimer_base() - wrong count at exit
|warning: context imbalance in hrtimer_start_range_ns() - unexpected unlock
|warning: context imbalance in hrtimer_try_to_cancel() - unexpected unlock
|warning: context imbalance in __hrtimer_get_remaining()
|- unexpected unlock
To fix this , an __acquires(timer) annotation is added.
Given that lock_hrtimer_base() does actually call READ_ONCE(timer->base).
This not only fixes the warnings
but also improves on readability of the code.
Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
---
kernel/time/hrtimer.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index 8de90ea31280..8f555b49395a 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -160,6 +160,7 @@ static inline bool is_migration_base(struct hrtimer_clock_base *base)
static
struct hrtimer_clock_base *lock_hrtimer_base(const struct hrtimer *timer,
unsigned long *flags)
+ __acquires(timer)
{
struct hrtimer_clock_base *base;
--
2.24.1
next prev parent reply other threads:[~2020-01-24 20:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <0/3>
2020-01-24 20:08 ` [PATCH 0/3] Lock warning cleanup Jules Irenge
2020-01-24 20:12 ` [PATCH 2/3] futex: Add missing annotation for wake_futex_pi() Jules Irenge
2020-01-24 20:12 ` [PATCH 3/3] mutex: Add missing annotations Jules Irenge
2020-01-27 8:51 ` Peter Zijlstra
2020-02-01 0:27 ` Jules Irenge
2020-01-24 20:12 ` Jules Irenge [this message]
2020-01-24 22:04 ` [PATCH 1/3] time: Add missing annotation to lock_hrtimer_base() Thomas Gleixner
2020-01-25 1:26 ` Jules Irenge
2020-02-01 0:04 ` [PATCH 0/3] Lock warning cleanups Jules Irenge
2020-02-01 0:04 ` [PATCH 1/3] hrtimer: Add missing annotation to lock_hrtimer_base() Jules Irenge
2020-02-01 0:04 ` [PATCH 2/3] futex: Add missing annotation for wake_futex_pi() Jules Irenge
2020-02-01 0:04 ` [PATCH 3/3] futex: Add missing annotation for fixup_pi_state_owner() Jules Irenge
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=31c31ca2d78d9368d38e1a5909bc0c9a7be5dc98.1579893447.git.jbi.octave@gmail.com \
--to=jbi.octave@gmail.com \
--cc=boqun.feng@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®