From: Alex Elder Date: Tue, 17 May 2016 14:13:16 +0000 (-0500) Subject: greybus: connection: verify disabled when destroyed X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=814ae531d161d789496503969657ea9550e286b5;p=linux-beck.git greybus: connection: verify disabled when destroyed A connection must be in DISABLED state before it gets destroyed. Warn if this is ever not the case (and do the disconnect) before proceeding with connection destruction. Signed-off-by: Alex Elder Reviewed-by: Viresh Kumar Reviewed-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c index f803d40413ac..ac3be2fceade 100644 --- a/drivers/staging/greybus/connection.c +++ b/drivers/staging/greybus/connection.c @@ -660,6 +660,9 @@ void gb_connection_destroy(struct gb_connection *connection) if (!connection) return; + if (WARN_ON(connection->state != GB_CONNECTION_STATE_DISABLED)) + gb_connection_disable(connection); + mutex_lock(&gb_connection_mutex); spin_lock_irq(&gb_connections_lock);