]> git.karo-electronics.de Git - linux-beck.git/commitdiff
greybus: connection: verify disabled when destroyed
authorAlex Elder <elder@linaro.org>
Tue, 17 May 2016 14:13:16 +0000 (09:13 -0500)
committerGreg Kroah-Hartman <gregkh@google.com>
Wed, 18 May 2016 23:38:11 +0000 (16:38 -0700)
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>
drivers/staging/greybus/connection.c

index f803d40413ac00eafa4b6e3eaab93b881d4988bc..ac3be2fceade13a4ef26ce4d24e51fb25aa5e85e 100644 (file)
@@ -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);