[PATCH 4/6] net: atm: Add missing annotation for lec_seq_stop()

Jules Irenge
2020-04-29T10:07:08Z

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

The root cause is the missing annotation at lec_seq_stop()
The __release() annotation inside lec_seq_stop()
tells only Sparse to shutdown the warning

Add the missing __releases(&state->locked->lec_arp_lock)
Add __release(&state->locked->lec_arp_lock) annotation

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

diff --git a/net/atm/lec.c b/net/atm/lec.c
index 25fa3a7b72bd..22415bc11878 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -940,6 +940,7 @@ static void *lec_seq_start(struct seq_file *seq, loff_t *pos)
}

static void lec_seq_stop(struct seq_file *seq, void *v)
+ __releases(&state->locked->lec_arp_lock)
{
struct lec_state *state = seq->private;

@@ -947,7 +948,9 @@ static void lec_seq_stop(struct seq_file *seq, void *v)
spin_unlock_irqrestore(&state->locked->lec_arp_lock,
state->flags);
dev_put(state->dev);
- }
+ } else
+ /* annotation for sparse */
+ __release(&state->locked->lec_arp_lock);
}

static void *lec_seq_next(struct seq_file *seq, void *v, loff_t *pos)
--
2.25.3