]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
greybus: protocol: make protocol-lookup error message more informative
authorJohan Hovold <johan@hovoldconsulting.com>
Tue, 13 Oct 2015 17:10:28 +0000 (19:10 +0200)
committerGreg Kroah-Hartman <gregkh@google.com>
Wed, 14 Oct 2015 19:08:50 +0000 (12:08 -0700)
Make protocol lookup error more informative, by moving it to
gb_connection_bind_protocol and using dev_err.

Also make sure to use hex format for the protocol id as that is what is
used everywhere else.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/connection.c
drivers/staging/greybus/protocol.c

index 1158674f22014061784b37a0fe825c2b9186dea9..ca812f8a44f87c9d93d83db8b43d01aae5d43981 100644 (file)
@@ -551,8 +551,13 @@ int gb_connection_bind_protocol(struct gb_connection *connection)
        protocol = gb_protocol_get(connection->protocol_id,
                                   connection->major,
                                   connection->minor);
-       if (!protocol)
+       if (!protocol) {
+               dev_warn(&connection->dev,
+                               "protocol 0x%02hhx version %hhu.%hhu not found\n",
+                               connection->protocol_id,
+                               connection->major, connection->minor);
                return 0;
+       }
        connection->protocol = protocol;
 
        /*
index 41190e8dfccb7bf88810308f71dd4c5016a91f97..889cff2a10c2354710cc62f18dfe17467bf030d8 100644 (file)
@@ -144,9 +144,6 @@ struct gb_protocol *gb_protocol_get(u8 id, u8 major, u8 minor)
 
        if (protocol)
                WARN_ON(protocol_count == U8_MAX);
-       else
-               pr_err("protocol id %hhu version %hhu.%hhu not found\n",
-                       id, major, minor);
 
        return protocol;
 }