From d3d2bea16149f36b0b654a0874cb9092ff86b134 Mon Sep 17 00:00:00 2001 From: Alex Elder Date: Thu, 26 Mar 2015 21:25:01 -0500 Subject: [PATCH] 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 Reviewed-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/operation.c | 5 ++--- drivers/staging/greybus/protocol.c | 14 ++++++-------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c index d5fa2f04642d..5117f0b08331 100644 --- a/drivers/staging/greybus/operation.c +++ b/drivers/staging/greybus/operation.c @@ -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); diff --git a/drivers/staging/greybus/protocol.c b/drivers/staging/greybus/protocol.c index 51549e20f398..ba4cc0f4ac8c 100644 --- a/drivers/staging/greybus/protocol.c +++ b/drivers/staging/greybus/protocol.c @@ -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); }