]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
greybus: gb_hd_connection_find(): fix "not found" case
authorMarti Bolivar <mbolivar@leaflabs.com>
Mon, 6 Oct 2014 17:26:02 +0000 (13:26 -0400)
committerGreg Kroah-Hartman <greg@kroah.com>
Mon, 6 Oct 2014 17:39:06 +0000 (10:39 -0700)
Without this, null-testing the return value of this function is
broken.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/staging/greybus/connection.c

index 449ae34bf531d6b4829871dfdef1378a207cfcb8..07a593d2cbd146e69373517e3736fbc5bab0b487 100644 (file)
@@ -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;