Skip to contentSkip to conversation

Staging: i2o: Remove assignment in if condition

PATCH In review Vatika Harlalka 2 participants 2 messages Feb 18, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: i2o: Remove assignment in if condition

This patch removes the assignment in an if condition to do away with the checkpatch warning :'do not use assignment in if condition'.

---
 drivers/staging/i2o/bus-osm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/i2o/bus-osm.c +2 -2
index 7aa0339..70b15b2 100644
@@ -67,9 +67,9 @@ static ssize_t i2o_bus_store_scan(struct device *d,
 				  const char *buf, size_t count)
 {
 	struct i2o_device *i2o_dev = to_i2o_device(d);
-	int rc;
+	int rc = i2o_bus_scan(i2o_dev);
 
-	if ((rc = i2o_bus_scan(i2o_dev)))
+	if (rc)
 		osm_warn("bus scan failed %d\n", rc);
 
 	return count;
Signature · 1 line
1.9.1
#1 lore raw
Quoted 13 lines · Vatika Harlalka

This patch removes the assignment in an if condition to do away with the checkpatch warning :'do not use assignment in if condition'.

---
 drivers/staging/i2o/bus-osm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/i2o/bus-osm.c +0 -0
index 7aa0339..70b15b2 100644

drivers/staging/i2o/bus-osm.c static ssize_t i2o_bus_store_scan(struct device *d, · line 70

Quoted 5 lines
drivers/staging/i2o/bus-osm.c +1 -1
@@ -67,9 +67,9 @@ static ssize_t i2o_bus_store_scan(struct device *d,
 				  const char *buf, size_t count)
 {
 	struct i2o_device *i2o_dev = to_i2o_device(d);
-	int rc;
+	int rc = i2o_bus_scan(i2o_dev);

Unlike to_i2o_device, which is just an accessor function (a macro actually), i2o_bus_scan does real work. I think it would be better as a top-level statement, right before its error checking code.

julia

Quoted 16 lines
drivers/staging/i2o/bus-osm.c +1 -1
-	if ((rc = i2o_bus_scan(i2o_dev)))
+	if (rc)
 		osm_warn("bus scan failed %d\n", rc);
 
 	return count;
Signature · 8 lines
1.9.1

-- 
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20150218190158.GA17577%40gmail.com.
For more options, visit https://groups.google.com/d/optout.