Commit c01576c8 authored by Mark Brown's avatar Mark Brown Committed by Sebastian Reichel

power: wm831x_power: Convert to devm_kzalloc()

Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarSebastian Reichel <sre@kernel.org>
parent 69fb4dca
......@@ -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 @@ static int wm831x_power_probe(struct platform_device *pdev)
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;
}
......
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