Commit c45bb35f authored by Mark Brown's avatar Mark Brown

regulator: fixed: Use devm_kzalloc()

Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 33426e97
...@@ -176,7 +176,8 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev) ...@@ -176,7 +176,8 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev)
if (!config) if (!config)
return -ENOMEM; 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) { if (drvdata == NULL) {
dev_err(&pdev->dev, "Failed to allocate device data\n"); dev_err(&pdev->dev, "Failed to allocate device data\n");
ret = -ENOMEM; ret = -ENOMEM;
...@@ -270,7 +271,6 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev) ...@@ -270,7 +271,6 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev)
err_name: err_name:
kfree(drvdata->desc.name); kfree(drvdata->desc.name);
err: err:
kfree(drvdata);
return ret; return ret;
} }
...@@ -282,7 +282,6 @@ static int __devexit reg_fixed_voltage_remove(struct platform_device *pdev) ...@@ -282,7 +282,6 @@ static int __devexit reg_fixed_voltage_remove(struct platform_device *pdev)
if (gpio_is_valid(drvdata->gpio)) if (gpio_is_valid(drvdata->gpio))
gpio_free(drvdata->gpio); gpio_free(drvdata->gpio);
kfree(drvdata->desc.name); kfree(drvdata->desc.name);
kfree(drvdata);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment