if (ret)
goto err_hd_cport_disable;
- ret = gb_connection_control_connected(connection);
- if (ret)
- goto err_svc_destroy;
-
- /* Need to enable the connection to initialize it */
spin_lock_irq(&connection->lock);
connection->state = GB_CONNECTION_STATE_ENABLED;
spin_unlock_irq(&connection->lock);
+ ret = gb_connection_control_connected(connection);
+ if (ret)
+ goto err_svc_destroy;
+
ret = gb_connection_protocol_get_version(connection);
if (ret)
goto err_disconnect;
return 0;
err_disconnect:
+ gb_connection_control_disconnected(connection);
+
spin_lock_irq(&connection->lock);
- connection->state = GB_CONNECTION_STATE_ERROR;
+ connection->state = GB_CONNECTION_STATE_DISABLED;
spin_unlock_irq(&connection->lock);
-
- gb_connection_control_disconnected(connection);
err_svc_destroy:
gb_connection_svc_connection_destroy(connection);
err_hd_cport_disable:
gb_connection_cancel_operations(connection, -ESHUTDOWN);
connection->protocol->connection_exit(connection);
+
gb_connection_control_disconnected(connection);
+
+ spin_lock_irq(&connection->lock);
+ connection->state = GB_CONNECTION_STATE_DISABLED;
+ spin_unlock_irq(&connection->lock);
+
gb_connection_svc_connection_destroy(connection);
gb_connection_hd_cport_disable(connection);
gb_connection_unbind_protocol(connection);
GB_CONNECTION_STATE_INVALID = 0,
GB_CONNECTION_STATE_DISABLED = 1,
GB_CONNECTION_STATE_ENABLED = 2,
- GB_CONNECTION_STATE_ERROR = 3,
- GB_CONNECTION_STATE_DESTROYING = 4,
+ GB_CONNECTION_STATE_DESTROYING = 3,
};
struct gb_connection {