Skip to contentSkip to conversation

mfd: Remove unneeded ret value checking

PATCH In review Axel Lin 2 participants 3 messages Oct 22, 2010 Multifunction devices (MFD)

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/2 mfd: Remove unneeded ret value checking

i2c_smbus_write_byte_data() returns zero or negative value, therefore no need to check if ret is greater than zero or not.

---
 drivers/mfd/max8998.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/mfd/max8998.c +0 -2
index a720f41..06ddf74 100644
@@ -110,8 +110,6 @@ int max8998_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask)
 		u8 old_val = ret & 0xff;
 		u8 new_val = (val & mask) | (old_val & (~mask));
 		ret = i2c_smbus_write_byte_data(i2c, reg, new_val);
-		if (ret >= 0)
-			ret = 0;
 	}
 	mutex_unlock(&max8998->iolock);
 	return ret;
Signature · 1 line
1.7.2
author
#1 lore raw

PATCH 2/2 mfd: Fix resource reclaim for max8998

Properly free irq and unregister max8998->rtc device in max8998_i2c_probe() error path and max8998_i2c_remove().

---
 drivers/mfd/max8998.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/mfd/max8998.c +4 -0
index 06ddf74..bb9977b 100644
@@ -153,6 +153,8 @@ static int max8998_i2c_probe(struct i2c_client *i2c,
 
 err:
 	mfd_remove_devices(max8998->dev);
+	max8998_irq_exit(max8998);
+	i2c_unregister_device(max8998->rtc);
 	kfree(max8998);
 	return ret;
 }
@@ -162,6 +164,8 @@ static int max8998_i2c_remove(struct i2c_client *i2c)
 	struct max8998_dev *max8998 = i2c_get_clientdata(i2c);
 
 	mfd_remove_devices(max8998->dev);
+	max8998_irq_exit(max8998);
+	i2c_unregister_device(max8998->rtc);
 	kfree(max8998);
 
 	return 0;
Signature · 1 line
1.7.2
#2 lore raw
In reply to Axel Lin

Hi Axel,

Quoted 2 lines · Axel Lin

i2c_smbus_write_byte_data() returns zero or negative value, therefore no need to check if ret is greater than zero or not.

All 3 (including the mc13xx one) patches applied, many thanks.

Cheers,
Samuel.

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/