greybus: connection: fail on missing protocol
authorJohan Hovold <johan@hovoldconsulting.com>
Mon, 7 Dec 2015 14:05:31 +0000 (15:05 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Tue, 8 Dec 2015 20:31:14 +0000 (15:31 -0500)
Make sure to fail properly when a protocol is missing.

This prevents the connection from being created, which is fine as we
currently never bind protocols post creation.

This is an intermediate step in moving protocol binding to
connection_init.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/connection.c

index bf28dad230b7d7b9525c5617bc8687412255dca9..ae8cb6603a5e48920a5c7e78bf73bfe14e21cb99 100644 (file)
@@ -537,11 +537,11 @@ static int gb_connection_bind_protocol(struct gb_connection *connection)
                                   connection->major,
                                   connection->minor);
        if (!protocol) {
-               dev_warn(&connection->hd->dev,
+               dev_err(&connection->hd->dev,
                                "protocol 0x%02x version %u.%u not found\n",
                                connection->protocol_id,
                                connection->major, connection->minor);
-               return 0;
+               return -EPROTONOSUPPORT;
        }
        connection->protocol = protocol;