1
0
Fork 0

greybus: connection: Fix sparse warnings around locking

The callers ensures that connection->lock is taken before calling few
routines, but that isn't enough for sparse as it sees an unexpected
unlock.

greybus/connection.c:380:29: warning: context imbalance in 'gb_connection_cancel_operations' - unexpected unlock

Fix that adding __must_lock() attribute to the function declaration.

This also adds the attribute for
gb_connection_flush_incoming_operations(), which isn't showing any
sparse warnings with the current state of code, but with minor
rearrangements of the code.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
hifive-unleashed-5.1
Viresh Kumar 2016-01-28 15:50:48 +05:30 committed by Greg Kroah-Hartman
parent 68ba0a01cc
commit 127c1fbd55
1 changed files with 2 additions and 0 deletions

View File

@ -373,6 +373,7 @@ gb_connection_control_disconnected(struct gb_connection *connection)
*/
static void gb_connection_cancel_operations(struct gb_connection *connection,
int errno)
__must_hold(&connection->lock)
{
struct gb_operation *operation;
@ -401,6 +402,7 @@ static void gb_connection_cancel_operations(struct gb_connection *connection,
static void
gb_connection_flush_incoming_operations(struct gb_connection *connection,
int errno)
__must_hold(&connection->lock)
{
struct gb_operation *operation;
bool incoming;