linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jules Irenge <jbi.octave@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Shannon Nelson <snelson@pensando.io>,
	Thomas Gleixner <tglx@linutronix.de>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	netdev@vger.kernel.org (open list:NETWORKING [GENERAL])
Subject: [PATCH 6/6] net: atm: Add annotation for lec_priv_walk()
Date: Wed, 29 Apr 2020 11:05:28 +0100	[thread overview]
Message-ID: <20200429100529.19645-7-jbi.octave@gmail.com> (raw)
In-Reply-To: <20200429100529.19645-1-jbi.octave@gmail.com>

Sparse reports a warning at lec_priv_walk()
warning: context imbalance in lec_priv_walk() - unexpected unlock

The root cause is the missing annotation at lec_priv_walk()
To fix this, __acquire() and __release() annotations
are added in case conditions are not met.
This only instruct  Sparse to shutdown the warning

Add the  __acquire(&priv->lec_arp_lock)
Add __release(&priv->lec_arp_lock) annotation

Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
---
 net/atm/lec.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/atm/lec.c b/net/atm/lec.c
index 22415bc11878..6070acaa3d5c 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -886,12 +886,18 @@ static void *lec_priv_walk(struct lec_state *state, loff_t *l,
 	if (!state->locked) {
 		state->locked = priv;
 		spin_lock_irqsave(&priv->lec_arp_lock, state->flags);
+	} else {
+		/* annotation for sparse */
+		__acquire(&priv->lec_arp_lock);
 	}
 	if (!lec_arp_walk(state, l, priv) && !lec_misc_walk(state, l, priv)) {
 		spin_unlock_irqrestore(&priv->lec_arp_lock, state->flags);
 		state->locked = NULL;
 		/* Partial state reset for the next time we get called */
 		state->arp_table = state->misc_table = 0;
+	} else {
+		/* annotation for sparse */
+		__release(&priv->lec_arp_lock);
 	}
 	return state->locked;
 }
-- 
2.25.3


  parent reply	other threads:[~2020-04-29 10:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <0/6>
2020-03-16 23:37 ` [PATCH 0/6] lock warning cleanups Jules Irenge
2020-03-16 23:37   ` [PATCH 1/6] namei: Add missing annotation for unlazy_walk() Jules Irenge
2020-03-16 23:38   ` [PATCH 2/6] namei: Add missing annotation for unlazy_child() Jules Irenge
2020-03-16 23:38   ` [PATCH 3/6] fs: Add missing annotation for __wait_on_freeing_inode() Jules Irenge
2020-03-16 23:38   ` [PATCH 4/6] fs/fs-writeback.c: Add missing annotation for wbc_attach_and_unlock_inode() Jules Irenge
2020-03-16 23:38   ` [PATCH 5/6] fs/fs-writeback.c: replace two annotations for __inode_wait_for_writeback() Jules Irenge
2020-03-16 23:38   ` [PATCH 6/6] fs: add missing annotation for pin_kill() Jules Irenge
2020-04-29 10:05 ` [PATCH 0/6] Lock warnings cleanup Jules Irenge
2020-04-29 10:05   ` [PATCH 1/6] usb: gadget: Add missing annotation for xudc_handle_setup() Jules Irenge
2020-04-29 10:05   ` [PATCH 2/6] udp: Add missing annotations for busylock_acquire() and busylock_release() Jules Irenge
2020-04-29 10:05   ` [PATCH 3/6] udp: Add annotations for udp_rmem_release() Jules Irenge
2020-04-29 10:05   ` [PATCH 4/6] net: atm: Add missing annotation for lec_seq_stop() Jules Irenge
2020-04-29 10:05   ` [PATCH 5/6] USB: dummy-hcd: Add missing annotation for set_link_state() Jules Irenge
2020-04-29 10:05   ` Jules Irenge [this message]
2020-04-29 10:22     ` [PATCH 6/6] net: atm: Add annotation for lec_priv_walk() Andy Shevchenko
2020-04-29 14:58 ` [PATCH v2] net: atm: Add annotation for lec_priv_walk() and lec_seq_stop() Jules Irenge

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=20200429100529.19645-7-jbi.octave@gmail.com \
    --to=jbi.octave@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=snelson@pensando.io \
    --cc=tglx@linutronix.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;
as well as URLs for NNTP newsgroup(s).