public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers/w1: cleanup w1_uevent
@ 2012-05-18  8:49 Devendra Naga
  2012-05-19  3:31 ` Evgeniy Polyakov
  0 siblings, 1 reply; 8+ messages in thread
From: Devendra Naga @ 2012-05-18  8:49 UTC (permalink / raw)
  To: Evgeniy Polyakov, linux-kernel; +Cc: Devendra Naga

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>
---
 drivers/w1/w1.c |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 9761950..a0d3c59 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -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)
 {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-06-04 21:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-18  8:49 [PATCH] drivers/w1: cleanup w1_uevent Devendra Naga
2012-05-19  3:31 ` Evgeniy Polyakov
2012-06-04 11:45   ` devendra.aaru
2012-06-04 18:05     ` Evgeniy Polyakov
2012-06-04 18:53       ` GregKH
2012-06-04 19:25         ` Evgeniy Polyakov
2012-06-04 21:43           ` devendra.aaru
2012-06-04 21:56             ` Evgeniy Polyakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox