From: Viresh Kumar Date: Thu, 28 Jan 2016 10:20:48 +0000 (+0530) Subject: greybus: connection: Fix sparse warnings around locking X-Git-Tag: v4.9-rc1~119^2~378^2~21^2~731 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=127c1fbd55939642365f26efd3121562629ec1b1;p=karo-tx-linux.git 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 Reviewed-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c index 77c2f672b405..4f5e2adfa8c4 100644 --- a/drivers/staging/greybus/connection.c +++ b/drivers/staging/greybus/connection.c @@ -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;