summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2015-08-20 15:12:43 -0700
committerSebastian Reichel <sre@kernel.org>2015-09-22 13:35:28 +0200
commitc01576c8f3445208036eac72ea6703b452d42612 (patch)
tree1518cb04d241bc9150926bd4f48e30a15966a23c /drivers/power
parent69fb4dcada7704beeba86e3f401a66c726aa8504 (diff)
power: wm831x_power: Convert to devm_kzalloc()
Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/wm831x_power.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/power/wm831x_power.c b/drivers/power/wm831x_power.c
index db11ae6599f3..c826c83fdf98 100644
--- a/drivers/power/wm831x_power.c
+++ b/drivers/power/wm831x_power.c
@@ -499,7 +499,8 @@ static int wm831x_power_probe(struct platform_device *pdev)
struct wm831x_power *power;
int ret, irq, i;
- power = kzalloc(sizeof(struct wm831x_power), GFP_KERNEL);
+ power = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_power),
+ GFP_KERNEL);
if (power == NULL)
return -ENOMEM;
@@ -536,7 +537,7 @@ static int wm831x_power_probe(struct platform_device *pdev)
NULL);
if (IS_ERR(power->wall)) {
ret = PTR_ERR(power->wall);
- goto err_kmalloc;
+ goto err;
}
power->usb_desc.name = power->usb_name,
@@ -626,8 +627,7 @@ err_usb:
power_supply_unregister(power->usb);
err_wall:
power_supply_unregister(power->wall);
-err_kmalloc:
- kfree(power);
+err:
return ret;
}
@@ -654,7 +654,6 @@ static int wm831x_power_remove(struct platform_device *pdev)
power_supply_unregister(wm831x_power->battery);
power_supply_unregister(wm831x_power->wall);
power_supply_unregister(wm831x_power->usb);
- kfree(wm831x_power);
return 0;
}