greybus: clean up some small messes
authorAlex Elder <elder@linaro.org>
Fri, 27 Mar 2015 02:25:01 +0000 (21:25 -0500)
committerGreg Kroah-Hartman <greg@kroah.com>
Fri, 27 Mar 2015 10:16:35 +0000 (11:16 +0100)
This is an old patch that I neglected to send out.  It's cleaning
up a couple things that got committed before I had a chance to
comment on them.

In operation.c there is a "FIXME" comment that is easily proven
wrong by inspection.

In gb_protocol_put(), there is another wrong "FIXME" comment as
well.  We can also use our cached copies of the protocol major
and minor version number in another spot.  And balance that
out by using a cached copy of the protocol id.

Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/staging/greybus/operation.c
drivers/staging/greybus/protocol.c

index d5fa2f0..5117f0b 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Greybus operations
  *
- * Copyright 2014 Google Inc.
- * Copyright 2014 Linaro Ltd.
+ * Copyright 2014-2015 Google Inc.
+ * Copyright 2014-2015 Linaro Ltd.
  *
  * Released under the GPLv2 only.
  */
@@ -732,7 +732,6 @@ int gb_operation_response_send(struct gb_operation *operation, int errno)
                }
        }
 
-       /* FIXME operation->response could still be NULL here */
        /* Fill in the response header and send it */
        operation->response->header->result = gb_operation_errno_map(errno);
 
index 51549e2..ba4cc0f 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Greybus protocol handling
  *
- * Copyright 2014 Google Inc.
- * Copyright 2014 Linaro Ltd.
+ * Copyright 2014-2015 Google Inc.
+ * Copyright 2014-2015 Linaro Ltd.
  *
  * Released under the GPLv2 only.
  */
@@ -191,6 +191,7 @@ EXPORT_SYMBOL_GPL(gb_protocol_get_version);
 
 void gb_protocol_put(struct gb_protocol *protocol)
 {
+       u8 id;
        u8 major;
        u8 minor;
        u8 protocol_count;
@@ -198,12 +199,12 @@ void gb_protocol_put(struct gb_protocol *protocol)
        if (!protocol)
                return;
 
+       id = protocol->id;
        major = protocol->major;
        minor = protocol->minor;
 
        spin_lock_irq(&gb_protocols_lock);
-       protocol = _gb_protocol_find(protocol->id, protocol->major,
-                                               protocol->minor);
+       protocol = _gb_protocol_find(id, major, minor);
        if (protocol) {
                protocol_count = protocol->count;
                if (protocol_count)
@@ -214,9 +215,6 @@ void gb_protocol_put(struct gb_protocol *protocol)
        if (protocol)
                WARN_ON(!protocol_count);
        else
-               /* FIXME a different message is needed since this one
-                * will result in a NULL dereference
-                */
                pr_err("protocol id %hhu version %hhu.%hhu not found\n",
-                       protocol->id, major, minor);
+                       id, major, minor);
 }