Commit 8d7a712c authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

greybus: connection: clean up init error paths

Clearly mark error-path labels as such and clean up control flow.
Signed-off-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent a95c258c
...@@ -405,7 +405,7 @@ static int gb_connection_init(struct gb_connection *connection) ...@@ -405,7 +405,7 @@ static int gb_connection_init(struct gb_connection *connection)
dev_err(&connection->dev, dev_err(&connection->dev,
"Failed to connect CPort-%d (%d)\n", "Failed to connect CPort-%d (%d)\n",
cport_id, ret); cport_id, ret);
goto svc_destroy; goto err_svc_destroy;
} }
} }
...@@ -424,21 +424,23 @@ static int gb_connection_init(struct gb_connection *connection) ...@@ -424,21 +424,23 @@ static int gb_connection_init(struct gb_connection *connection)
dev_err(&connection->dev, dev_err(&connection->dev,
"Failed to get version CPort-%d (%d)\n", "Failed to get version CPort-%d (%d)\n",
cport_id, ret); cport_id, ret);
goto disconnect; goto err_disconnect;
} }
} }
ret = protocol->connection_init(connection); ret = protocol->connection_init(connection);
if (!ret) if (ret)
return 0; goto err_disconnect;
return 0;
disconnect: err_disconnect:
spin_lock_irq(&connection->lock); spin_lock_irq(&connection->lock);
connection->state = GB_CONNECTION_STATE_ERROR; connection->state = GB_CONNECTION_STATE_ERROR;
spin_unlock_irq(&connection->lock); spin_unlock_irq(&connection->lock);
gb_connection_disconnected(connection); gb_connection_disconnected(connection);
svc_destroy: err_svc_destroy:
gb_connection_svc_connection_destroy(connection); gb_connection_svc_connection_destroy(connection);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment