public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: Serguey Parkhomovsky <sergueyparkhomovsky@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	navin patidar <navin.patidar@gmail.com>,
	Elena Oat <oat.elena@gmail.com>, Tim Jester-Pfadt <t.jp@gmx.de>
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: rtl8188eu: rtw_mlme.c: fix sparse warning
Date: Mon, 29 Dec 2014 00:20:29 -0600	[thread overview]
Message-ID: <54A0F2AD.6060505@lwfinger.net> (raw)
In-Reply-To: <20141229054706.GA8062@fedora.localdomain>

On 12/28/2014 11:47 PM, Serguey Parkhomovsky wrote:
> Fixes the following sparse warning for rtw_mlme.c:
>
> drivers/staging/rtl8188eu/core/rtw_mlme.c:810:9: warning: context imbalance in 'rtw_free_assoc_resources' - different lock contexts for basic block
>
> Signed-off-by: Serguey Parkhomovsky <sergueyparkhomovsky@gmail.com>
> ---
>   drivers/staging/rtl8188eu/core/rtw_mlme.c | 37 ++++++++++++++++++++-----------
>   1 file changed, 24 insertions(+), 13 deletions(-)

Are these many changes needed just because Sparse is not smart enough to 
understand that the following does not really have a context imbalance:

	if (lock_scanned_queue)
		spin_lock_bh(&(pmlmepriv->scanned_queue.lock));
	.....
	.....

	if (lock_scanned_queue)
   		spin_unlock_bh(&pmlmepriv->scanned_queue.lock);

Nothing in the middle touches lock_scanned_queue, thus if the spin lock and 
unlock operations will be paired. That is all that is important. The fact that 
some tool objects to this construct means that the tool is broken, not the code.

In my mind, Sparse warnings/errors/checks are in place to alert you to a 
possible problem. If they point to white space issues, then you fix them. If 
they point to lines that are too long, then you see if you can shorten them 
without harming the readability. In any case, judgement should be used before 
blindly trying to silence the warning.

For those reasons, NACK.

Larry



      reply	other threads:[~2014-12-29  6:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-29  5:47 [PATCH] staging: rtl8188eu: rtw_mlme.c: fix sparse warning Serguey Parkhomovsky
2014-12-29  6:20 ` Larry Finger [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=54A0F2AD.6060505@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=navin.patidar@gmail.com \
    --cc=oat.elena@gmail.com \
    --cc=sergueyparkhomovsky@gmail.com \
    --cc=t.jp@gmx.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