aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-03 18:20:56 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-04 06:38:52 -0400
commit02b552160f955a6dd6a54600f262365dc8916d69 (patch)
treebcc872ae750cd3ef2a9ca706bfc486e642dc67a6 /drivers/regulator
parent69d715a142f393bbcf1c05b440c074bed2aa0416 (diff)
regulator: gpio-regulator: Basic devm_kzalloc() conversion
There's some other allocations but they're not so trivial as they use kmemdup() and kstrdup(). Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/gpio-regulator.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c
index 5f9b6add5d1d..ad0fc78c3cb4 100644
--- a/drivers/regulator/gpio-regulator.c
+++ b/drivers/regulator/gpio-regulator.c
@@ -174,7 +174,8 @@ static int __devinit gpio_regulator_probe(struct platform_device *pdev)
174 struct gpio_regulator_data *drvdata; 174 struct gpio_regulator_data *drvdata;
175 int ptr, ret, state; 175 int ptr, ret, state;
176 176
177 drvdata = kzalloc(sizeof(struct gpio_regulator_data), GFP_KERNEL); 177 drvdata = devm_kzalloc(&pdev->dev, sizeof(struct gpio_regulator_data),
178 GFP_KERNEL);
178 if (drvdata == NULL) { 179 if (drvdata == NULL) {
179 dev_err(&pdev->dev, "Failed to allocate device data\n"); 180 dev_err(&pdev->dev, "Failed to allocate device data\n");
180 return -ENOMEM; 181 return -ENOMEM;
@@ -307,7 +308,6 @@ err_memgpio:
307err_name: 308err_name:
308 kfree(drvdata->desc.name); 309 kfree(drvdata->desc.name);
309err: 310err:
310 kfree(drvdata);
311 return ret; 311 return ret;
312} 312}
313 313
@@ -326,7 +326,6 @@ static int __devexit gpio_regulator_remove(struct platform_device *pdev)
326 gpio_free(drvdata->enable_gpio); 326 gpio_free(drvdata->enable_gpio);
327 327
328 kfree(drvdata->desc.name); 328 kfree(drvdata->desc.name);
329 kfree(drvdata);
330 329
331 return 0; 330 return 0;
332} 331}