linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Roland Dreier <rdreier@cisco.com>
Cc: linux-kernel@vger.kernel.org, linux-sparse@vger.kernel.org,
	David Brownell <david-b@pacbell.net>
Subject: Re: Sparse annotation for "context imbalance" false positives?
Date: Thu, 15 May 2008 17:20:02 +0200	[thread overview]
Message-ID: <1210864802.3900.8.camel@johannes.berg> (raw)
In-Reply-To: <ada7idvfw0c.fsf@cisco.com>

[-- Attachment #1: Type: text/plain, Size: 967 bytes --]


> but the problem sparse sees is not that some paths take only one lock
> and some take two -- sparse is complaining that this function is
> returning without unlocking the locks that it takes.  Even if I change
> the function to something as simple as:
> 
> 	static void mlx4_ib_lock_cqs(struct mlx4_ib_cq *send_cq, struct mlx4_ib_cq *recv_cq)
> 	{
> 		spin_lock_irq(&recv_cq->lock);
> 	}
> 
> I still get
> 
>     drivers/infiniband/hw/mlx4/qp.c:603:13: warning: context imbalance in 'mlx4_ib_lock_cqs' - wrong count at exitn

Oh. Well yes, you also have to annotate the function:

static void mlx4_ib_lock_cqs(struct mlx4_ib_cq *send_cq, struct mlx4_ib_cq *recv_cq)
	__acquires(&recv_cq->lock) __acquires(&send_cq->lock)
{
	...
}

but we're still discussing whether the & should be in there or not. I'd
think right now is a bad time for you to be working on this unless you
want to help with how sparse should behave too.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

      reply	other threads:[~2008-05-15 15:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-15  3:16 Sparse annotation for "context imbalance" false positives? Roland Dreier
2008-05-15  8:54 ` Johannes Berg
2008-05-15 15:05   ` Roland Dreier
2008-05-15 15:20     ` Johannes Berg [this message]

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=1210864802.3900.8.camel@johannes.berg \
    --to=johannes@sipsolutions.net \
    --cc=david-b@pacbell.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=rdreier@cisco.com \
    /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).