* [PATCH 1/3] regulator: isl6271a-regulator: Use devm_kzalloc()
@ 2012-04-11 15:05 Axel Lin
2012-04-11 15:06 ` [PATCH 2/3] regulator: max1586: " Axel Lin
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Axel Lin @ 2012-04-11 15:05 UTC (permalink / raw)
To: linux-kernel; +Cc: Marek Vasut, Liam Girdwood, Mark Brown
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/regulator/isl6271a-regulator.c | 7 +------
1 files changed, 1 insertions(+), 6 deletions(-)
diff --git a/drivers/regulator/isl6271a-regulator.c b/drivers/regulator/isl6271a-regulator.c
index 863f45a..60044c3 100644
--- a/drivers/regulator/isl6271a-regulator.c
+++ b/drivers/regulator/isl6271a-regulator.c
@@ -148,7 +148,7 @@ static int __devinit isl6271a_probe(struct i2c_client *i2c,
if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return -EIO;
- pmic = kzalloc(sizeof(struct isl_pmic), GFP_KERNEL);
+ pmic = devm_kzalloc(&i2c->dev, sizeof(struct isl_pmic), GFP_KERNEL);
if (!pmic)
return -ENOMEM;
@@ -179,8 +179,6 @@ static int __devinit isl6271a_probe(struct i2c_client *i2c,
error:
while (--i >= 0)
regulator_unregister(pmic->rdev[i]);
-
- kfree(pmic);
return err;
}
@@ -191,9 +189,6 @@ static int __devexit isl6271a_remove(struct i2c_client *i2c)
for (i = 0; i < 3; i++)
regulator_unregister(pmic->rdev[i]);
-
- kfree(pmic);
-
return 0;
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/3] regulator: max1586: Use devm_kzalloc()
2012-04-11 15:05 [PATCH 1/3] regulator: isl6271a-regulator: Use devm_kzalloc() Axel Lin
@ 2012-04-11 15:06 ` Axel Lin
2012-04-11 15:08 ` [PATCH 3/3] regulator: max8660: " Axel Lin
2012-04-13 8:59 ` [PATCH 1/3] regulator: isl6271a-regulator: " Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Axel Lin @ 2012-04-11 15:06 UTC (permalink / raw)
To: linux-kernel; +Cc: Robert Jarzmik, Liam Girdwood, Mark Brown
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/regulator/max1586.c | 16 +++++-----------
1 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/drivers/regulator/max1586.c b/drivers/regulator/max1586.c
index ea832b4..b9444ee 100644
--- a/drivers/regulator/max1586.c
+++ b/drivers/regulator/max1586.c
@@ -189,18 +189,17 @@ static int __devinit max1586_pmic_probe(struct i2c_client *client,
struct max1586_data *max1586;
int i, id, ret = -ENOMEM;
- max1586 = kzalloc(sizeof(struct max1586_data) +
+ max1586 = devm_kzalloc(&client->dev, sizeof(struct max1586_data) +
sizeof(struct regulator_dev *) * (MAX1586_V6 + 1),
GFP_KERNEL);
if (!max1586)
- goto out;
+ return -ENOMEM;
max1586->client = client;
- if (!pdata->v3_gain) {
- ret = -EINVAL;
- goto out_unmap;
- }
+ if (!pdata->v3_gain)
+ return -EINVAL;
+
max1586->min_uV = MAX1586_V3_MIN_UV / 1000 * pdata->v3_gain / 1000;
max1586->max_uV = MAX1586_V3_MAX_UV / 1000 * pdata->v3_gain / 1000;
@@ -234,9 +233,6 @@ static int __devinit max1586_pmic_probe(struct i2c_client *client,
err:
while (--i >= 0)
regulator_unregister(rdev[i]);
-out_unmap:
- kfree(max1586);
-out:
return ret;
}
@@ -248,8 +244,6 @@ static int __devexit max1586_pmic_remove(struct i2c_client *client)
for (i = 0; i <= MAX1586_V6; i++)
if (max1586->rdev[i])
regulator_unregister(max1586->rdev[i]);
- kfree(max1586);
-
return 0;
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 3/3] regulator: max8660: Use devm_kzalloc()
2012-04-11 15:05 [PATCH 1/3] regulator: isl6271a-regulator: Use devm_kzalloc() Axel Lin
2012-04-11 15:06 ` [PATCH 2/3] regulator: max1586: " Axel Lin
@ 2012-04-11 15:08 ` Axel Lin
2012-04-13 8:59 ` [PATCH 1/3] regulator: isl6271a-regulator: " Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Axel Lin @ 2012-04-11 15:08 UTC (permalink / raw)
To: linux-kernel; +Cc: Wolfram Sang, Liam Girdwood, Mark Brown
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/regulator/max8660.c | 20 +++++++-------------
1 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/drivers/regulator/max8660.c b/drivers/regulator/max8660.c
index 88f678e..9997cfb 100644
--- a/drivers/regulator/max8660.c
+++ b/drivers/regulator/max8660.c
@@ -367,16 +367,14 @@ static int __devinit max8660_probe(struct i2c_client *client,
if (pdata->num_subdevs > MAX8660_V_END) {
dev_err(&client->dev, "Too many regulators found!\n");
- goto out;
+ return -EINVAL;
}
max8660 = kzalloc(sizeof(struct max8660) +
sizeof(struct regulator_dev *) * MAX8660_V_END,
GFP_KERNEL);
- if (!max8660) {
- ret = -ENOMEM;
- goto out;
- }
+ if (!max8660)
+ return -ENOMEM;
max8660->client = client;
rdev = max8660->rdev;
@@ -405,7 +403,7 @@ static int __devinit max8660_probe(struct i2c_client *client,
for (i = 0; i < pdata->num_subdevs; i++) {
if (!pdata->subdevs[i].platform_data)
- goto err_free;
+ goto err_out;
boot_on = pdata->subdevs[i].platform_data->constraints.boot_on;
@@ -431,7 +429,7 @@ static int __devinit max8660_probe(struct i2c_client *client,
case MAX8660_V7:
if (!strcmp(i2c_id->name, "max8661")) {
dev_err(&client->dev, "Regulator not on this chip!\n");
- goto err_free;
+ goto err_out;
}
if (boot_on)
@@ -441,7 +439,7 @@ static int __devinit max8660_probe(struct i2c_client *client,
default:
dev_err(&client->dev, "invalid regulator %s\n",
pdata->subdevs[i].name);
- goto err_free;
+ goto err_out;
}
}
@@ -469,9 +467,7 @@ static int __devinit max8660_probe(struct i2c_client *client,
err_unregister:
while (--i >= 0)
regulator_unregister(rdev[i]);
-err_free:
- kfree(max8660);
-out:
+err_out:
return ret;
}
@@ -483,8 +479,6 @@ static int __devexit max8660_remove(struct i2c_client *client)
for (i = 0; i < MAX8660_V_END; i++)
if (max8660->rdev[i])
regulator_unregister(max8660->rdev[i]);
- kfree(max8660);
-
return 0;
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 1/3] regulator: isl6271a-regulator: Use devm_kzalloc()
2012-04-11 15:05 [PATCH 1/3] regulator: isl6271a-regulator: Use devm_kzalloc() Axel Lin
2012-04-11 15:06 ` [PATCH 2/3] regulator: max1586: " Axel Lin
2012-04-11 15:08 ` [PATCH 3/3] regulator: max8660: " Axel Lin
@ 2012-04-13 8:59 ` Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2012-04-13 8:59 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, Marek Vasut, Liam Girdwood
[-- Attachment #1: Type: text/plain, Size: 127 bytes --]
On Wed, Apr 11, 2012 at 11:05:49PM +0800, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
Applied all, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-04-13 8:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-11 15:05 [PATCH 1/3] regulator: isl6271a-regulator: Use devm_kzalloc() Axel Lin
2012-04-11 15:06 ` [PATCH 2/3] regulator: max1586: " Axel Lin
2012-04-11 15:08 ` [PATCH 3/3] regulator: max8660: " Axel Lin
2012-04-13 8:59 ` [PATCH 1/3] regulator: isl6271a-regulator: " Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox