Skip to contentSkip to conversation

i2c: Drop dummy variable

PATCH In review Jean Delvare 2 participants 2 messages Jun 16, 2010 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: Drop dummy variable

Now that bus_for_each_drv() is no longer __must_check, we can drop the dummy variable that was used to store the returned value.

Cc Justin P. Mattock <[email protected]>

---
Anticipating that my other patch will be accepted...

 drivers/i2c/i2c-core.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/i2c/i2c-core.c +2 -3
@@ -783,7 +783,7 @@ static int __process_new_adapter(struct
 
 static int i2c_register_adapter(struct i2c_adapter *adap)
 {
-	int res = 0, dummy;
+	int res = 0;
 
 	/* Can't register until after driver model init */
 	if (unlikely(WARN_ON(!i2c_bus_type.p))) {
@@ -821,8 +821,7 @@ static int i2c_register_adapter(struct i
 
 	/* Notify drivers */
 	mutex_lock(&core_lock);
-	dummy = bus_for_each_drv(&i2c_bus_type, NULL, adap,
-				 __process_new_adapter);
+	bus_for_each_drv(&i2c_bus_type, NULL, adap, __process_new_adapter);
 	mutex_unlock(&core_lock);
 
 	return 0;
Signature · 1 line
Jean Delvare

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 25 lines · Jean Delvare

Now that bus_for_each_drv() is no longer __must_check, we can drop the dummy variable that was used to store the returned value.

Cc Justin P. Mattock<[email protected]>

---
Anticipating that my other patch will be accepted...

  drivers/i2c/i2c-core.c |    5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
drivers/i2c/i2c-core.c +1 -1
@@ -783,7 +783,7 @@ static int __process_new_adapter(struct
 
  static int i2c_register_adapter(struct i2c_adapter *adap)
  {
-	int res = 0, dummy;
+	int res = 0;
 
  	/* Can't register until after driver model init */
  	if (unlikely(WARN_ON(!i2c_bus_type.p))) {

drivers/i2c/i2c-core.c static int i2c_register_adapter(struct i · line 827

Quoted 9 lines
drivers/i2c/i2c-core.c +1 -2
@@ -821,8 +821,7 @@ static int i2c_register_adapter(struct i
 
  	/* Notify drivers */
  	mutex_lock(&core_lock);
-	dummy = bus_for_each_drv(&i2c_bus_type, NULL, adap,
-				 __process_new_adapter);
+	bus_for_each_drv(&i2c_bus_type, NULL, adap, __process_new_adapter);
  	mutex_unlock(&core_lock);
 
  	return 0;

cool thanks!! applied the above patch and now the warning is no longer there. Here is what I see:

  LD      kernel/built-in.o
  CC      drivers/i2c/i2c-core.o
  LD      drivers/i2c/built-in.o
  CC [M]  drivers/uio/uio.o

cheers,

Justin P. Mattock