Skip to content

Commit

Permalink
regulator: fixed: Use devm_kzalloc()
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Mark Brown committed Apr 1, 2012
1 parent 33426e9 commit c45bb35
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/regulator/fixed.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -270,7 +271,6 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev)
err_name:
kfree(drvdata->desc.name);
err:
kfree(drvdata);
return ret;
}

Expand All @@ -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;
}
Expand Down

0 comments on commit c45bb35

Please sign in to comment.