From: Jim Cromie <jim.cromie@gmail.com>
To: linux-sparse@vger.kernel.org
Subject: sparse problems with __acquires, __releases
Date: Sun, 7 Aug 2011 21:48:30 -0600 [thread overview]
Message-ID: <CAJfuBxzGFiFj-bZ7J6aqffMXaxy33mhs0r3nvbFfRS8TBj_8XA@mail.gmail.com> (raw)
hi all,
after trying to use __acquires, __releases in lib/dynamic_debug.c
I get the following warning.
[jimc@harpo linux-2.6]$ make C=1 lib/dynamic_debug.o
CHK include/linux/version.h
CHK include/generated/utsrelease.h
CALL scripts/checksyscalls.sh
CHECK lib/dynamic_debug.c
lib/dynamic_debug.c:548:13: warning: context imbalance in
'ddebug_proc_start' - wrong count at exit
lib/dynamic_debug.c:629:13: warning: context imbalance in
'ddebug_proc_stop' - wrong count at exit
CC lib/dynamic_debug.o
Thinking I did it wrong, I tried C=1 on other uses in the source..
The closest usage to mine (that I found) is in drivers/tty/tty_io.c:
void tty_write_unlock(struct tty_struct *tty)
__releases(&tty->atomic_write_lock)
{
mutex_unlock(&tty->atomic_write_lock);
wake_up_interruptible_poll(&tty->write_wait, POLLOUT);
}
int tty_write_lock(struct tty_struct *tty, int ndelay)
__acquires(&tty->atomic_write_lock)
{...}
it also gives errors, like mine.
[jimc@harpo linux-2.6]$ make C=1 drivers/tty/tty_io.o
CHK include/linux/version.h
CHK include/generated/utsrelease.h
CALL scripts/checksyscalls.sh
CHECK drivers/tty/tty_io.c
drivers/tty/tty_io.c:217:6: warning: symbol 'tty_del_file' was not
declared. Should it be static?
drivers/tty/tty_io.c:536:6: warning: symbol '__tty_hangup' was not
declared. Should it be static?
drivers/tty/tty_io.c:964:6: warning: context imbalance in
'tty_write_unlock' - wrong count at exit
drivers/tty/tty_io.c:971:5: warning: context imbalance in
'tty_write_lock' - wrong count at exit
drivers/tty/tty_io.c:1093:17: warning: context imbalance in
'tty_write_message' - unexpected unlock
drivers/tty/tty_io.c:1115:16: warning: context imbalance in
'tty_write' - different lock contexts for basic block
drivers/tty/tty_io.c:2429:12: warning: context imbalance in
'send_break' - different lock contexts for basic block
CC drivers/tty/tty_io.o
Heres my usage:
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 75ca78f..a2f82f2 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -546,6 +546,7 @@ static struct _ddebug *ddebug_iter_next(struct
ddebug_iter *iter)
* seeks the seq_file's iterator to the given position.
*/
static void *ddebug_proc_start(struct seq_file *m, loff_t *pos)
+ __acquires(ddebug_lock)
{
struct ddebug_iter *iter = m->private;
struct _ddebug *dp;
@@ -626,6 +627,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p)
* call from userspace. Drops ddebug_lock.
*/
static void ddebug_proc_stop(struct seq_file *m, void *p)
+ __releases(ddebug_lock)
{
if (verbose)
printk(KERN_INFO "%s: called m=%p p=%p\n",
reply other threads:[~2011-08-08 3:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=CAJfuBxzGFiFj-bZ7J6aqffMXaxy33mhs0r3nvbFfRS8TBj_8XA@mail.gmail.com \
--to=jim.cromie@gmail.com \
--cc=linux-sparse@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).