summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/gpio-regulator.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-03 23:20:56 +0100
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-04 11:38:52 +0100
commit02b552160f955a6dd6a54600f262365dc8916d69 (patch)
treebcc872ae750cd3ef2a9ca706bfc486e642dc67a6 /drivers/regulator/gpio-regulator.c
parent69d715a142f393bbcf1c05b440c074bed2aa0416 (diff)
downloadlinux-02b552160f955a6dd6a54600f262365dc8916d69.tar.gz
linux-02b552160f955a6dd6a54600f262365dc8916d69.tar.bz2
linux-02b552160f955a6dd6a54600f262365dc8916d69.zip
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/gpio-regulator.c')
-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)
struct gpio_regulator_data *drvdata;
int ptr, ret, state;
- drvdata = kzalloc(sizeof(struct gpio_regulator_data), GFP_KERNEL);
+ drvdata = devm_kzalloc(&pdev->dev, sizeof(struct gpio_regulator_data),
+ GFP_KERNEL);
if (drvdata == NULL) {
dev_err(&pdev->dev, "Failed to allocate device data\n");
return -ENOMEM;
@@ -307,7 +308,6 @@ err_memgpio:
err_name:
kfree(drvdata->desc.name);
err:
- kfree(drvdata);
return ret;
}
@@ -326,7 +326,6 @@ static int __devexit gpio_regulator_remove(struct platform_device *pdev)
gpio_free(drvdata->enable_gpio);
kfree(drvdata->desc.name);
- kfree(drvdata);
return 0;
}