From: Marti Bolivar Date: Mon, 6 Oct 2014 17:26:02 +0000 (-0400) Subject: greybus: gb_hd_connection_find(): fix "not found" case X-Git-Tag: v4.9-rc1~119^2~378^2~21^2~2028 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e86905b6cd73ce62af88b3526dbc10c14d47016d;p=karo-tx-linux.git greybus: gb_hd_connection_find(): fix "not found" case Without this, null-testing the return value of this function is broken. Signed-off-by: Marti Bolivar Reviewed-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c index 449ae34bf531..07a593d2cbd1 100644 --- a/drivers/staging/greybus/connection.c +++ b/drivers/staging/greybus/connection.c @@ -56,8 +56,10 @@ struct gb_connection *gb_hd_connection_find(struct greybus_host_device *hd, else if (connection->hd_cport_id < cport_id) node = node->rb_right; else - break; + goto found; } + connection = NULL; + found: spin_unlock_irq(&gb_connections_lock); return connection;