greybus: operation: fix some sparse warnings
authorGreg Kroah-Hartman <greg@kroah.com>
Mon, 27 Oct 2014 04:30:15 +0000 (12:30 +0800)
committerGreg Kroah-Hartman <greg@kroah.com>
Mon, 27 Oct 2014 04:30:15 +0000 (12:30 +0800)
One of which was "real".

Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/staging/greybus/operation.c

index 5d23d1977297fe5fe1e0a16081853b72ada7d9ae..c94e50965f28fcac711ea1f47fe83a56902231a3 100644 (file)
@@ -274,8 +274,14 @@ static void gb_operation_gbuf_complete(struct gbuf *gbuf)
                        header = operation->response_payload;
                else
                        header = NULL;
-               id = header ? (int)header->id : -1;
-               type = header ? (int)header->type : -1;
+
+               if (header) {
+                       id = le16_to_cpu(header->id);
+                       type = header->type;
+               } else {
+                       id = -1;
+                       type = -1;
+               }
 
                gb_connection_err(operation->connection,
                        "operation %d type %d gbuf error %d",
@@ -292,8 +298,9 @@ static void gb_operation_gbuf_complete(struct gbuf *gbuf)
  * initialize it here (it'll be overwritten by the incoming
  * message).
  */
-struct gbuf *gb_operation_gbuf_create(struct gb_operation *operation,
-                                       u8 type, size_t size, bool data_out)
+static struct gbuf *gb_operation_gbuf_create(struct gb_operation *operation,
+                                            u8 type, size_t size,
+                                            bool data_out)
 {
        struct gb_connection *connection = operation->connection;
        struct gb_operation_msg_hdr *header;