From 52fa38327b39f1d307447023a8eea1f7b7ca0039 Mon Sep 17 00:00:00 2001 From: Perry Hung Date: Fri, 24 Jul 2015 19:02:30 -0400 Subject: [PATCH] greybus: connection: silence warning on unbound protocols If a protocol was not successfully created, we can't drop the refcount on it. This might happen for example if the connection fails to bind a protocol. Silences a warning on cleanup. Signed-off-by: Perry Hung Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/connection.c | 3 ++- drivers/staging/greybus/protocol.c | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c index 0cd716d..c57deb2 100644 --- a/drivers/staging/greybus/connection.c +++ b/drivers/staging/greybus/connection.c @@ -319,7 +319,8 @@ void gb_connection_destroy(struct gb_connection *connection) list_del(&connection->hd_links); spin_unlock_irq(&gb_connections_lock); - gb_protocol_put(connection->protocol); + if (connection->protocol) + gb_protocol_put(connection->protocol); connection->protocol = NULL; id_map = &connection->hd->cport_id_map; diff --git a/drivers/staging/greybus/protocol.c b/drivers/staging/greybus/protocol.c index 6aebbbd..06b4841 100644 --- a/drivers/staging/greybus/protocol.c +++ b/drivers/staging/greybus/protocol.c @@ -196,9 +196,6 @@ void gb_protocol_put(struct gb_protocol *protocol) u8 minor; u8 protocol_count; - if (WARN_ON(!protocol)) - return; - id = protocol->id; major = protocol->major; minor = protocol->minor; -- 2.7.4