Add initialized flag and use instead of the connection protocol pointer
to determine when the legacy connection has been initialised.
This is a step in moving legacy connection binding to
connection-creation time.
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
struct legacy_connection {
struct gb_connection *connection;
+ bool initialized;
};
struct legacy_data {
if (ret)
goto err_disable;
+ lc->initialized = true;
+
return 0;
err_disable:
{
struct gb_connection *connection = lc->connection;
- if (!connection->protocol)
+ if (!lc->initialized)
return;
gb_connection_disable(connection);
connection->protocol->connection_exit(connection);
legacy_connection_unbind_protocol(connection);
+
+ lc->initialized = false;
}
static int legacy_connection_create(struct legacy_connection *lc,