summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/connection.c
diff options
context:
space:
mode:
authorAlex Elder2016-05-17 16:13:16 +0200
committerGreg Kroah-Hartman2016-05-19 01:38:11 +0200
commit814ae531d161d789496503969657ea9550e286b5 (patch)
tree76ff5bc52de022c44403859e1535279ff47eee59 /drivers/staging/greybus/connection.c
parentgreybus: audio: gb_manager: Use valid argument while removing ida allocated id. (diff)
downloadkernel-qcow2-linux-814ae531d161d789496503969657ea9550e286b5.tar.gz
kernel-qcow2-linux-814ae531d161d789496503969657ea9550e286b5.tar.xz
kernel-qcow2-linux-814ae531d161d789496503969657ea9550e286b5.zip
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 <elder@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/connection.c')
-rw-r--r--drivers/staging/greybus/connection.c3
1 files changed, 3 insertions, 0 deletions
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);