Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
if (!pdata)
return -ENODEV;
- ldo = kzalloc(sizeof(struct wm8994_ldo), GFP_KERNEL);
+ ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm8994_ldo), GFP_KERNEL);
if (ldo == NULL) {
dev_err(&pdev->dev, "Unable to allocate private data\n");
return -ENOMEM;
if (gpio_is_valid(ldo->enable))
gpio_free(ldo->enable);
err:
- kfree(ldo);
return ret;
}
regulator_unregister(ldo->regulator);
if (gpio_is_valid(ldo->enable))
gpio_free(ldo->enable);
- kfree(ldo);
return 0;
}