]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
greybus: bundle: refactor gb_bundle_find()
authorAlex Elder <elder@linaro.org>
Fri, 12 Jun 2015 15:21:10 +0000 (10:21 -0500)
committerGreg Kroah-Hartman <gregkh@google.com>
Fri, 12 Jun 2015 19:14:24 +0000 (12:14 -0700)
Rearrange gb_bundle_find() so it follows the pattern used by
gb_connection_find().

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/bundle.c

index 6e9d03ac7e35a3b85ac765cff64c05cac6053e9c..89568b2b0adf817edcc1b6ef1146cd97ffe8241b 100644 (file)
@@ -283,13 +283,13 @@ struct gb_bundle *gb_bundle_find(struct gb_interface *intf, u8 bundle_id)
 
        spin_lock_irq(&gb_bundles_lock);
        list_for_each_entry(bundle, &intf->bundles, links)
-               if (bundle->id == bundle_id) {
-                       spin_unlock_irq(&gb_bundles_lock);
-                       return bundle;
-               }
+               if (bundle->id == bundle_id)
+                       goto found;
+       bundle = NULL;
+found:
        spin_unlock_irq(&gb_bundles_lock);
 
-       return NULL;
+       return bundle;
 }
 
 static int gb_bundle_connections_init(struct gb_bundle *bundle)