diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-03-21 18:13:29 +0000 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-01 11:59:26 +0100 |
commit | c45bb35f8b76439f4b6c0efaca510f871e9b1840 (patch) | |
tree | 15ee3bdc8fb3abeab5e45888c7e7afba1130f272 | |
parent | 33426e97968113d5421acc82b494d8a035ca4331 (diff) |
regulator: fixed: Use devm_kzalloc()
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | drivers/regulator/fixed.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c index 40f38030b39..7d4f381d55a 100644 --- a/drivers/regulator/fixed.c +++ b/drivers/regulator/fixed.c @@ -176,7 +176,8 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev) if (!config) return -ENOMEM; - drvdata = kzalloc(sizeof(struct fixed_voltage_data), GFP_KERNEL); + drvdata = devm_kzalloc(&pdev->dev, sizeof(struct fixed_voltage_data), + GFP_KERNEL); if (drvdata == NULL) { dev_err(&pdev->dev, "Failed to allocate device data\n"); ret = -ENOMEM; @@ -270,7 +271,6 @@ err_gpio: err_name: kfree(drvdata->desc.name); err: - kfree(drvdata); return ret; } @@ -282,7 +282,6 @@ static int __devexit reg_fixed_voltage_remove(struct platform_device *pdev) if (gpio_is_valid(drvdata->gpio)) gpio_free(drvdata->gpio); kfree(drvdata->desc.name); - kfree(drvdata); return 0; } |