greybus: connection: clean up init error paths
authorJohan Hovold <johan@hovoldconsulting.com>
Thu, 17 Sep 2015 11:17:22 +0000 (13:17 +0200)
committerGreg Kroah-Hartman <gregkh@google.com>
Thu, 17 Sep 2015 21:33:07 +0000 (14:33 -0700)
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>
drivers/staging/greybus/connection.c

index 8abac19f0c4396f9755cebbbec4696ddcb398e8b..5b8aa04a9f15a9f6c72b592ebc458917fe15f834 100644 (file)
@@ -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;