summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/connection.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2015-09-17 13:17:22 +0200
committerGreg Kroah-Hartman <gregkh@google.com>2015-09-17 14:33:07 -0700
commit8d7a712ca86b4da7220b8c3da37f118fed3e0bb2 (patch)
treeaaa5dd8502f033112e3939aaa969e69005646a94 /drivers/staging/greybus/connection.c
parenta95c258c6fe6b4929f52398d1b6cd5432efe2c86 (diff)
downloadlinux-stable-8d7a712ca86b4da7220b8c3da37f118fed3e0bb2.tar.gz
linux-stable-8d7a712ca86b4da7220b8c3da37f118fed3e0bb2.tar.bz2
linux-stable-8d7a712ca86b4da7220b8c3da37f118fed3e0bb2.zip
greybus: connection: clean up init error paths
Clearly mark error-path labels as such and clean up control flow. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/connection.c')
-rw-r--r--drivers/staging/greybus/connection.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c
index 8abac19f0c43..5b8aa04a9f15 100644
--- a/drivers/staging/greybus/connection.c
+++ b/drivers/staging/greybus/connection.c
@@ -405,7 +405,7 @@ static int gb_connection_init(struct gb_connection *connection)
dev_err(&connection->dev,
"Failed to connect CPort-%d (%d)\n",
cport_id, ret);
- goto svc_destroy;
+ goto err_svc_destroy;
}
}
@@ -424,21 +424,23 @@ static int gb_connection_init(struct gb_connection *connection)
dev_err(&connection->dev,
"Failed to get version CPort-%d (%d)\n",
cport_id, ret);
- goto disconnect;
+ goto err_disconnect;
}
}
ret = protocol->connection_init(connection);
- if (!ret)
- return 0;
+ if (ret)
+ goto err_disconnect;
+
+ return 0;
-disconnect:
+err_disconnect:
spin_lock_irq(&connection->lock);
connection->state = GB_CONNECTION_STATE_ERROR;
spin_unlock_irq(&connection->lock);
gb_connection_disconnected(connection);
-svc_destroy:
+err_svc_destroy:
gb_connection_svc_connection_destroy(connection);
return ret;