Skip to contentSkip to conversation

drivers/w1: cleanup w1_uevent

PATCH In review Devendra Naga 3 participants 8 messages May 18, 2012 – Jun 4, 2012 W1 dallas's 1-wire bus

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/w1: cleanup w1_uevent

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.

---
 drivers/w1/w1.c |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/w1/w1.c +6 -8
index 9761950..a0d3c59 100644
@@ -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)
 {
Signature · 1 line
1.7.9.5
#1 lore raw

Hi

Quoted 4 lines · 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.

I personally do not see whether this is better than what was before So, Greg, it is up to you to decide :)

If you pull it in, then feel free to add my acked-by. Thank you.

Quoted 45 lines
---
 drivers/w1/w1.c |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/w1/w1.c +6 -8
index 9761950..a0d3c59 100644
@@ -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)
 {
Signature · 1 line
1.7.9.5
Signature · 1 line
	Evgeniy Polyakov
#2 lore raw

Mr Greg,

are you going to take this in?

Thanks,
Devendra.

Quoted 15 lines · Evgeniy Polyakov

Hi

Quoted 4 lines · 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.

I personally do not see whether this is better than what was before So, Greg, it is up to you to decide :)

If you pull it in, then feel free to add my acked-by. Thank you.

       Evgeniy Polyakov

#3 lore raw
Quoted 3 lines · devendra.aaru

Mr Greg,

are you going to take this in?

Mister Greg, does it look ok, will you put it in? :)

Signature · 1 line
	Evgeniy Polyakov
#4 lore raw
Quoted 6 lines · Evgeniy Polyakov
Quoted 3 lines · devendra.aaru

Mr Greg,

are you going to take this in?

Mister Greg, does it look ok, will you put it in? :)

Yes, now that the merge window is open, I will queue it up.

thanks,

greg k-h

#5 lore raw
Quoted 3 lines · GregKH
Quoted 1 line

Mister Greg, does it look ok, will you put it in? :)

Yes, now that the merge window is open, I will queue it up.

Thank you very many, mister Greg :)

Signature · 1 line
	Evgeniy Polyakov
#6 lore raw
Quoted 9 lines · Evgeniy Polyakov
Quoted 3 lines · GregKH
Quoted 1 line

Mister Greg, does it look ok, will you put it in? :)

Yes, now that the merge window is open, I will queue it up.

Thank you very many, mister Greg :)

--
       Evgeniy Polyakov

sorry if i hurt any of you :/

Devendra.

#7 lore raw
Quoted 1 line · devendra.aaru

sorry if i hurt any of you :/

No hurt at all, no problem :))

Signature · 1 line
	Evgeniy Polyakov