w1: cleanup w1_uevent
authorDevendra Naga <devendra.aaru@gmail.com>
Sat, 19 May 2012 03:31:54 +0000 (07:31 +0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Jun 2012 22:27:32 +0000 (15:27 -0700)
There were some return statements around in the w1_uevent, used goto
to cleanup those return statements with the help of err variable,
and also removed a semi colon at the end of the w1_uevent's closing
brace.

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/w1/w1.c

index 69075c3dfc737289023a38973ff944671de2545a..79e488db5104487171ac985986d1497506f72b20 100644 (file)
@@ -557,7 +557,7 @@ static int w1_uevent(struct device *dev, struct kobj_uevent_env *env)
        struct w1_master *md = NULL;
        struct w1_slave *sl = NULL;
        char *event_owner, *name;
-       int err;
+       int err = 0;
 
        if (dev->driver == &w1_master_driver) {
                md = container_of(dev, struct w1_master, dev);
@@ -576,19 +576,17 @@ static int w1_uevent(struct device *dev, struct kobj_uevent_env *env)
                        event_owner, name, dev_name(dev));
 
        if (dev->driver != &w1_slave_driver || !sl)
-               return 0;
+               goto end;
 
        err = add_uevent_var(env, "W1_FID=%02X", sl->reg_num.family);
        if (err)
-               return err;
+               goto end;
 
        err = add_uevent_var(env, "W1_SLAVE_ID=%024LX",
                             (unsigned long long)sl->reg_num.id);
-       if (err)
-               return err;
-
-       return 0;
-};
+end:
+       return err;
+}
 #else
 static int w1_uevent(struct device *dev, struct kobj_uevent_env *env)
 {