* [PATCH 1/2] regulator: max8952 - fix max8952_pmic_probe error path
@ 2010-10-25 2:11 Axel Lin
2010-10-25 2:17 ` [PATCH 2/2] regulator: max8952 - fix max8952_set_voltage Axel Lin
2010-10-25 17:53 ` [PATCH 1/2] regulator: max8952 - fix max8952_pmic_probe error path Mark Brown
0 siblings, 2 replies; 5+ messages in thread
From: Axel Lin @ 2010-10-25 2:11 UTC (permalink / raw)
To: linux-kernel; +Cc: Liam Girdwood, Mark Brown, MyungJoo Ham, Kyungmin Park
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/regulator/max8952.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c
index f2af0b1..7d6aacf 100644
--- a/drivers/regulator/max8952.c
+++ b/drivers/regulator/max8952.c
@@ -212,9 +212,11 @@ static int __devinit max8952_pmic_probe(struct i2c_client *client,
max8952->rdev = regulator_register(®ulator, max8952->dev,
&pdata->reg_data, max8952);
- ret = IS_ERR(max8952->rdev);
- if (ret)
+ if (IS_ERR(max8952->rdev)) {
+ ret = PTR_ERR(max8952->rdev);
dev_err(max8952->dev, "regulator init failed (%d)\n", ret);
+ goto err_reg;
+ }
max8952->en = !!(pdata->reg_data.constraints.boot_on);
max8952->vid0 = (pdata->default_mode % 2) == 1;
@@ -309,6 +311,10 @@ static int __devinit max8952_pmic_probe(struct i2c_client *client,
i2c_set_clientdata(client, max8952);
+ return 0;
+
+err_reg:
+ kfree(max8952);
return ret;
}
--
1.7.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] regulator: max8952 - fix max8952_set_voltage
2010-10-25 2:11 [PATCH 1/2] regulator: max8952 - fix max8952_pmic_probe error path Axel Lin
@ 2010-10-25 2:17 ` Axel Lin
2010-10-25 17:55 ` Mark Brown
2010-10-25 17:53 ` [PATCH 1/2] regulator: max8952 - fix max8952_pmic_probe error path Mark Brown
1 sibling, 1 reply; 5+ messages in thread
From: Axel Lin @ 2010-10-25 2:17 UTC (permalink / raw)
To: linux-kernel; +Cc: Liam Girdwood, Mark Brown, MyungJoo Ham, Kyungmin Park
In current implementation, vid is declared as u8,
then "vid == -1" is always false, and "vid >= 0" is always true.
Thus change it to s8.
vid is always less than MAX8952_NUM_DVS_MODE in current implementation,
thus remove the cheking for "vid < MAX8952_NUM_DVS_MODE".
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/regulator/max8952.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c
index 7d6aacf..5b4601e 100644
--- a/drivers/regulator/max8952.c
+++ b/drivers/regulator/max8952.c
@@ -136,7 +136,7 @@ static int max8952_set_voltage(struct regulator_dev *rdev,
int min_uV, int max_uV)
{
struct max8952_data *max8952 = rdev_get_drvdata(rdev);
- u8 vid = -1, i;
+ s8 vid = -1, i;
if (!gpio_is_valid(max8952->pdata->gpio_vid0) ||
!gpio_is_valid(max8952->pdata->gpio_vid0)) {
@@ -153,7 +153,7 @@ static int max8952_set_voltage(struct regulator_dev *rdev,
vid = i;
}
- if (vid >= 0 && vid < MAX8952_NUM_DVS_MODE) {
+ if (vid >= 0) {
max8952->vid0 = (vid % 2 == 1);
max8952->vid1 = (((vid >> 1) % 2) == 1);
gpio_set_value(max8952->pdata->gpio_vid0, max8952->vid0);
--
1.7.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] regulator: max8952 - fix max8952_pmic_probe error path
2010-10-25 2:11 [PATCH 1/2] regulator: max8952 - fix max8952_pmic_probe error path Axel Lin
2010-10-25 2:17 ` [PATCH 2/2] regulator: max8952 - fix max8952_set_voltage Axel Lin
@ 2010-10-25 17:53 ` Mark Brown
1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2010-10-25 17:53 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, Liam Girdwood, MyungJoo Ham, Kyungmin Park
On Mon, Oct 25, 2010 at 10:11:07AM +0800, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] regulator: max8952 - fix max8952_set_voltage
2010-10-25 2:17 ` [PATCH 2/2] regulator: max8952 - fix max8952_set_voltage Axel Lin
@ 2010-10-25 17:55 ` Mark Brown
2010-10-25 23:55 ` Axel Lin
0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2010-10-25 17:55 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, Liam Girdwood, MyungJoo Ham, Kyungmin Park
On Mon, Oct 25, 2010 at 10:17:06AM +0800, Axel Lin wrote:
> In current implementation, vid is declared as u8,
> then "vid == -1" is always false, and "vid >= 0" is always true.
> Thus change it to s8.
>
> vid is always less than MAX8952_NUM_DVS_MODE in current implementation,
> thus remove the cheking for "vid < MAX8952_NUM_DVS_MODE".
This bit seems like reasonable paranoia in the face of future code
changes and we're not really in a sufficiently fast path to worry about
cycles - are you sure that this is essential?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] regulator: max8952 - fix max8952_set_voltage
2010-10-25 17:55 ` Mark Brown
@ 2010-10-25 23:55 ` Axel Lin
0 siblings, 0 replies; 5+ messages in thread
From: Axel Lin @ 2010-10-25 23:55 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-kernel, Liam Girdwood, MyungJoo Ham, Kyungmin Park
2010/10/26 Mark Brown <broonie@opensource.wolfsonmicro.com>:
> On Mon, Oct 25, 2010 at 10:17:06AM +0800, Axel Lin wrote:
>> In current implementation, vid is declared as u8,
>> then "vid == -1" is always false, and "vid >= 0" is always true.
>> Thus change it to s8.
>>
>> vid is always less than MAX8952_NUM_DVS_MODE in current implementation,
>> thus remove the cheking for "vid < MAX8952_NUM_DVS_MODE".
>
> This bit seems like reasonable paranoia in the face of future code
> changes and we're not really in a sufficiently fast path to worry about
> cycles - are you sure that this is essential?
>
Ok. I will send a v2 thant only change u8 to s8.
Regards,
Axel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-10-25 23:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-25 2:11 [PATCH 1/2] regulator: max8952 - fix max8952_pmic_probe error path Axel Lin
2010-10-25 2:17 ` [PATCH 2/2] regulator: max8952 - fix max8952_set_voltage Axel Lin
2010-10-25 17:55 ` Mark Brown
2010-10-25 23:55 ` Axel Lin
2010-10-25 17:53 ` [PATCH 1/2] regulator: max8952 - fix max8952_pmic_probe error path Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.