Re: Sparse annotation for "context imbalance" false positives?

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Johannes Berg <johannes@...>
Cc: <linux-kernel@...>, <linux-sparse@...>, David Brownell <david-b@...>
Date: Thursday, May 15, 2008 - 11:05 am

> You could, for example, insert this:
 > 
 > > 	static void mlx4_ib_lock_cqs(struct mlx4_ib_cq *send_cq, struct mlx4_ib_cq *recv_cq)
 > > 	{
 > > 		if (send_cq == recv_cq)
 > 		{
 > > 			spin_lock_irq(&send_cq->lock);
 > 			 /* pretend to have acquired both for sparse */	
 > 			__acquire(&recv_cq->lock);
 > 		}

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

thanks,
  Roland
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Sparse annotation for "context imbalance" false positives?, Roland Dreier, (Wed May 14, 11:16 pm)
Re: Sparse annotation for "context imbalance" false positives?, Roland Dreier, (Thu May 15, 11:05 am)