Commit 814ae531 authored by Alex Elder's avatar Alex Elder Committed by Greg Kroah-Hartman
Browse files

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: default avatarAlex Elder <elder@linaro.org>
Reviewed-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent ac00154a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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);