[PATCH 9/9] power: wakeup: Add missing annotation for wakeup_sources_read_lock() and wakeup_sources_read_unlock()

Jules Irenge
2020-04-11T00:20:38Z

Sparse reports warnings at wakeup_sources_read_lock()
and wakeup_sources_read_unlock()

warning: context imbalance in wakeup_sources_read_lock()
- wrong count at exit
context imbalance in wakeup_sources_read_unlock()
- unexpected unlock

The root cause is the missing annotation at
wakeup_sources_read_lock() and wakeup_sources_read_unlock()

Add the missing __acquires(&wakeup_srcu) annotation
Add the missing __releases(&wakeup_srcu) annotation

Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
---
drivers/base/power/wakeup.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
index 41ce086d8f57..753e9a46e04e 100644
--- a/drivers/base/power/wakeup.c
+++ b/drivers/base/power/wakeup.c
@@ -254,6 +254,7 @@ EXPORT_SYMBOL_GPL(wakeup_source_unregister);
* This index must be passed to the matching wakeup_sources_read_unlock().
*/
int wakeup_sources_read_lock(void)
+ __acquires(&wakeup_srcu)
{
return srcu_read_lock(&wakeup_srcu);
}
@@ -264,6 +265,7 @@ EXPORT_SYMBOL_GPL(wakeup_sources_read_lock);
* @idx: return value from corresponding wakeup_sources_read_lock()
*/
void wakeup_sources_read_unlock(int idx)
+ __releases(&wakeup_srcu)
{
srcu_read_unlock(&wakeup_srcu, idx);
}
--
2.24.1