Kobject: kobject_uevent.c: Collapse unnecessary loop nesting (top_kobj)
authorJohn Anthony Kazos Jr <jakj@j-a-k-j.com>
Wed, 4 Apr 2007 11:39:17 +0000 (07:39 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 27 Apr 2007 17:57:29 +0000 (10:57 -0700)
Collapses a do..while() loop within an if() to a simple while() loop for
simplicity and readability.

Signed-off-by: John Anthony Kazos Jr. <jakj@j-a-k-j.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
lib/kobject_uevent.c

index 4122f38330d48557111c7cdc7f10ab8161623322..d9a3510ed2e2f198b26846445eff73390cd7aa32 100644 (file)
@@ -95,10 +95,8 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
 
        /* search the kset we belong to */
        top_kobj = kobj;
-       if (!top_kobj->kset && top_kobj->parent) {
-               do {
-                       top_kobj = top_kobj->parent;
-               } while (!top_kobj->kset && top_kobj->parent);
+       while (!top_kobj->kset && top_kobj->parent) {
+               top_kobj = top_kobj->parent;
        }
        if (!top_kobj->kset) {
                pr_debug("kobject attempted to send uevent without kset!\n");