* [PATCH] mfd: max8998 cleanups
@ 2010-10-20 9:06 Axel Lin
2010-10-21 22:58 ` Samuel Ortiz
0 siblings, 1 reply; 3+ messages in thread
From: Axel Lin @ 2010-10-20 9:06 UTC (permalink / raw)
To: linux-kernel; +Cc: Samuel Ortiz, Kyungmin Park
This patch includes below fixes:
1. i2c_smbus_write_byte_data() returns zero or negative value,
therefore no need to check if ret is greater than zero or not.
2. Properly free irq and unregister max8998->rtc device in
max8998_i2c_probe() error path and max8998_i2c_remove().
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/mfd/max8998.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/max8998.c b/drivers/mfd/max8998.c
index a720f41..bb9977b 100644
--- a/drivers/mfd/max8998.c
+++ b/drivers/mfd/max8998.c
@@ -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;
@@ -155,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;
}
@@ -164,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;
--
1.7.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mfd: max8998 cleanups
2010-10-20 9:06 [PATCH] mfd: max8998 cleanups Axel Lin
@ 2010-10-21 22:58 ` Samuel Ortiz
2010-10-22 0:08 ` Axel Lin
0 siblings, 1 reply; 3+ messages in thread
From: Samuel Ortiz @ 2010-10-21 22:58 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, Kyungmin Park
Hi Axel,
On Wed, Oct 20, 2010 at 05:06:44PM +0800, Axel Lin wrote:
> This patch includes below fixes:
> 1. i2c_smbus_write_byte_data() returns zero or negative value,
> therefore no need to check if ret is greater than zero or not.
> 2. Properly free irq and unregister max8998->rtc device in
> max8998_i2c_probe() error path and max8998_i2c_remove().
The fixes make sense, I'd appreciate to get 2 separate patches for them
though.
Cheers,
Samuel.
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
> drivers/mfd/max8998.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mfd/max8998.c b/drivers/mfd/max8998.c
> index a720f41..bb9977b 100644
> --- a/drivers/mfd/max8998.c
> +++ b/drivers/mfd/max8998.c
> @@ -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;
> @@ -155,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;
> }
> @@ -164,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;
> --
> 1.7.2
>
>
>
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mfd: max8998 cleanups
2010-10-21 22:58 ` Samuel Ortiz
@ 2010-10-22 0:08 ` Axel Lin
0 siblings, 0 replies; 3+ messages in thread
From: Axel Lin @ 2010-10-22 0:08 UTC (permalink / raw)
To: Samuel Ortiz; +Cc: linux-kernel, Kyungmin Park
2010/10/22 Samuel Ortiz <sameo@linux.intel.com>:
> Hi Axel,
>
> On Wed, Oct 20, 2010 at 05:06:44PM +0800, Axel Lin wrote:
>> This patch includes below fixes:
>> 1. i2c_smbus_write_byte_data() returns zero or negative value,
>> therefore no need to check if ret is greater than zero or not.
>> 2. Properly free irq and unregister max8998->rtc device in
>> max8998_i2c_probe() error path and max8998_i2c_remove().
> The fixes make sense, I'd appreciate to get 2 separate patches for them
> though.
>
Ok. I will resend with 2 separate patches.
Regards,
Axel
> Cheers,
> Samuel.
>
>
>> Signed-off-by: Axel Lin <axel.lin@gmail.com>
>> ---
>> drivers/mfd/max8998.c | 6 ++++--
>> 1 files changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mfd/max8998.c b/drivers/mfd/max8998.c
>> index a720f41..bb9977b 100644
>> --- a/drivers/mfd/max8998.c
>> +++ b/drivers/mfd/max8998.c
>> @@ -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;
>> @@ -155,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;
>> }
>> @@ -164,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;
>> --
>> 1.7.2
>>
>>
>>
>
> --
> Intel Open Source Technology Centre
> http://oss.intel.com/
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-10-22 0:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-20 9:06 [PATCH] mfd: max8998 cleanups Axel Lin
2010-10-21 22:58 ` Samuel Ortiz
2010-10-22 0:08 ` Axel Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox