diff mbox series

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

Message ID 20200429100529.19645-5-jbi.octave@gmail.com
State Changes Requested
Delegated to: David Miller
Headers show
Series None | expand

Commit Message

Jules Irenge April 29, 2020, 10:05 a.m. UTC
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 mbox series

Patch

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)