mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-20 03:04:01 +08:00
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>
This commit is contained in:
parent
69d715a142
commit
02b552160f
@ -174,7 +174,8 @@ static int __devinit gpio_regulator_probe(struct platform_device *pdev)
|
|||||||
struct gpio_regulator_data *drvdata;
|
struct gpio_regulator_data *drvdata;
|
||||||
int ptr, ret, state;
|
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) {
|
if (drvdata == NULL) {
|
||||||
dev_err(&pdev->dev, "Failed to allocate device data\n");
|
dev_err(&pdev->dev, "Failed to allocate device data\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -307,7 +308,6 @@ err_memgpio:
|
|||||||
err_name:
|
err_name:
|
||||||
kfree(drvdata->desc.name);
|
kfree(drvdata->desc.name);
|
||||||
err:
|
err:
|
||||||
kfree(drvdata);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,7 +326,6 @@ static int __devexit gpio_regulator_remove(struct platform_device *pdev)
|
|||||||
gpio_free(drvdata->enable_gpio);
|
gpio_free(drvdata->enable_gpio);
|
||||||
|
|
||||||
kfree(drvdata->desc.name);
|
kfree(drvdata->desc.name);
|
||||||
kfree(drvdata);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user