greybus: clean up some small messes

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>
This commit is contained in:
Alex Elder 2015-03-26 21:25:01 -05:00 committed by Greg Kroah-Hartman
parent 938451f184
commit d3d2bea161
2 changed files with 8 additions and 11 deletions

View 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);

View 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);
}