Linux wireless drivers development
 help / color / mirror / Atom feed
* question about ...: wrong count at exit"
@ 2008-05-29  7:37 Holger Schurig
  2008-05-29  7:49 ` Johannes Berg
  0 siblings, 1 reply; 7+ messages in thread
From: Holger Schurig @ 2008-05-29  7:37 UTC (permalink / raw)
  To: Linux Wireless; +Cc: libertas-dev

After pulling the newest sparse, I got some new sparse warnings
which puzzle me. Here's one of them:

drivers/net/wireless/libertas/main.c:477:9: warning: context imbalance in 'lbs_eth_stop': wrong count at exit
drivers/net/wireless/libertas/main.c:477:9:    context 'lock': wanted 0, got 1

However, the function looks quite innocent, and I cannot see
any imbalance there. Did I oversee something or is that a
problem of sparse?

static int lbs_eth_stop(struct net_device *dev)
{
        struct lbs_private *priv = (struct lbs_private *) dev->priv;

        lbs_deb_enter(LBS_DEB_NET);

        spin_lock_irq(&priv->driver_lock);
        priv->infra_open = 0;
        netif_stop_queue(dev);
        spin_unlock_irq(&priv->driver_lock);

        schedule_work(&priv->mcast_work);

        lbs_deb_leave(LBS_DEB_NET);
        return 0;
}

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

* Re: question about ...: wrong count at exit"
  2008-05-29  7:37 question about ...: wrong count at exit" Holger Schurig
@ 2008-05-29  7:49 ` Johannes Berg
  2008-05-29  8:05   ` Holger Schurig
  2008-05-29  8:07   ` Tomas Winkler
  0 siblings, 2 replies; 7+ messages in thread
From: Johannes Berg @ 2008-05-29  7:49 UTC (permalink / raw)
  To: Holger Schurig; +Cc: Linux Wireless, libertas-dev

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

On Thu, 2008-05-29 at 09:37 +0200, Holger Schurig wrote:
> After pulling the newest sparse, I got some new sparse warnings
> which puzzle me. Here's one of them:
> 
> drivers/net/wireless/libertas/main.c:477:9: warning: context imbalance in 'lbs_eth_stop': wrong count at exit
> drivers/net/wireless/libertas/main.c:477:9:    context 'lock': wanted 0, got 1
> 
> However, the function looks quite innocent, and I cannot see
> any imbalance there. Did I oversee something or is that a
> problem of sparse?

>         spin_lock_irq(&priv->driver_lock);
>         priv->infra_open = 0;
>         netif_stop_queue(dev);
>         spin_unlock_irq(&priv->driver_lock);

I think it's a sparse problem caused by my patch, I sent further patches
to fix it but they were never applied (and had a slight remaining
problem too). If you look at the pre-processed function it should become
obvious.

johannes

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

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

* Re: question about ...: wrong count at exit"
  2008-05-29  7:49 ` Johannes Berg
@ 2008-05-29  8:05   ` Holger Schurig
  2008-05-29  8:07     ` Johannes Berg
  2008-05-29  8:07   ` Tomas Winkler
  1 sibling, 1 reply; 7+ messages in thread
From: Holger Schurig @ 2008-05-29  8:05 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, libertas-dev

Okay, reverted back to sparse 0.4.1



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

* Re: question about ...: wrong count at exit"
  2008-05-29  7:49 ` Johannes Berg
  2008-05-29  8:05   ` Holger Schurig
@ 2008-05-29  8:07   ` Tomas Winkler
  2008-05-29  8:33     ` Johannes Berg
  1 sibling, 1 reply; 7+ messages in thread
From: Tomas Winkler @ 2008-05-29  8:07 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Holger Schurig, Linux Wireless, libertas-dev

On Thu, May 29, 2008 at 10:49 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Thu, 2008-05-29 at 09:37 +0200, Holger Schurig wrote:
>> After pulling the newest sparse, I got some new sparse warnings
>> which puzzle me. Here's one of them:
>>
>> drivers/net/wireless/libertas/main.c:477:9: warning: context imbalance in 'lbs_eth_stop': wrong count at exit
>> drivers/net/wireless/libertas/main.c:477:9:    context 'lock': wanted 0, got 1
>>
>> However, the function looks quite innocent, and I cannot see
>> any imbalance there. Did I oversee something or is that a
>> problem of sparse?
>
>>         spin_lock_irq(&priv->driver_lock);
>>         priv->infra_open = 0;
>>         netif_stop_queue(dev);
>>         spin_unlock_irq(&priv->driver_lock);
>
> I think it's a sparse problem caused by my patch, I sent further patches
> to fix it but they were never applied (and had a slight remaining
> problem too). If you look at the pre-processed function it should become
> obvious.
>

I got plenty of this in the mac80211 reported with newest sparse, but
they looks false caused by 'goto statements'

Tomas

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

* Re: question about ...: wrong count at exit"
  2008-05-29  8:05   ` Holger Schurig
@ 2008-05-29  8:07     ` Johannes Berg
  0 siblings, 0 replies; 7+ messages in thread
From: Johannes Berg @ 2008-05-29  8:07 UTC (permalink / raw)
  To: Holger Schurig; +Cc: linux-wireless

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

On Thu, 2008-05-29 at 10:05 +0200, Holger Schurig wrote:
> Okay, reverted back to sparse 0.4.1

Mind you, the problem with that is that it will not flag

spin_lock(&a);
rcu_read_unlock();

as a bug. Which was the whole reason I hacked on sparse.

johannes

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

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

* Re: question about ...: wrong count at exit"
  2008-05-29  8:07   ` Tomas Winkler
@ 2008-05-29  8:33     ` Johannes Berg
  2008-05-29  8:37       ` Johannes Berg
  0 siblings, 1 reply; 7+ messages in thread
From: Johannes Berg @ 2008-05-29  8:33 UTC (permalink / raw)
  To: Tomas Winkler; +Cc: Holger Schurig, Linux Wireless, libertas-dev

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


> >> However, the function looks quite innocent, and I cannot see
> >> any imbalance there. Did I oversee something or is that a
> >> problem of sparse?
> >
> >>         spin_lock_irq(&priv->driver_lock);
> >>         priv->infra_open = 0;
> >>         netif_stop_queue(dev);
> >>         spin_unlock_irq(&priv->driver_lock);
> >
> > I think it's a sparse problem caused by my patch, I sent further patches
> > to fix it but they were never applied (and had a slight remaining
> > problem too). If you look at the pre-processed function it should become
> > obvious.
> >
> 
> I got plenty of this in the mac80211 reported with newest sparse, but
> they looks false caused by 'goto statements'

Probably similar issues. I have patches that haven't been applied and
with those, mac80211 is clean except for a new warning from netdevice.h,
one that I'll send a patch for in a minute, and the rc-pid algo one.

johannes

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

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

* Re: question about ...: wrong count at exit"
  2008-05-29  8:33     ` Johannes Berg
@ 2008-05-29  8:37       ` Johannes Berg
  0 siblings, 0 replies; 7+ messages in thread
From: Johannes Berg @ 2008-05-29  8:37 UTC (permalink / raw)
  To: Tomas Winkler; +Cc: Holger Schurig, Linux Wireless, libertas-dev

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


> one that I'll send a patch for in a minute,

actually, that one is caused by another local patch

johannes

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

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

end of thread, other threads:[~2008-05-29  8:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-29  7:37 question about ...: wrong count at exit" Holger Schurig
2008-05-29  7:49 ` Johannes Berg
2008-05-29  8:05   ` Holger Schurig
2008-05-29  8:07     ` Johannes Berg
2008-05-29  8:07   ` Tomas Winkler
2008-05-29  8:33     ` Johannes Berg
2008-05-29  8:37       ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox