diff options
| author | Thomas Weißschuh <linux@weissschuh.net> | 2025-10-16 09:34:35 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-10-19 16:34:03 +0200 |
| commit | 5187bb848aab42d43481d169cbcdb3d5df81c6a9 (patch) | |
| tree | bfdee266b0fd7ced0f240ae6ff3dd72d9d0201c2 /drivers/acpi | |
| parent | efbc2d6a929189ae44ff0ab812e2b1869c6bd80e (diff) | |
| download | linux-5187bb848aab42d43481d169cbcdb3d5df81c6a9.tar.gz linux-5187bb848aab42d43481d169cbcdb3d5df81c6a9.tar.bz2 linux-5187bb848aab42d43481d169cbcdb3d5df81c6a9.zip | |
ACPI: battery: allocate driver data through devm_ APIs
[ Upstream commit 909dfc60692331e1599d5e28a8f08a611f353aef ]
Simplify the cleanup logic a bit.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20240904-acpi-battery-cleanups-v1-2-a3bf74f22d40@weissschuh.net
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Stable-dep-of: 399dbcadc01e ("ACPI: battery: Add synchronization between interface updates")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/acpi')
| -rw-r--r-- | drivers/acpi/battery.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 65fa3444367a..c6e29e377b9c 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -1218,7 +1218,7 @@ static int acpi_battery_add(struct acpi_device *device) if (device->dep_unmet) return -EPROBE_DEFER; - battery = kzalloc(sizeof(struct acpi_battery), GFP_KERNEL); + battery = devm_kzalloc(&device->dev, sizeof(*battery), GFP_KERNEL); if (!battery) return -ENOMEM; battery->device = device; @@ -1256,7 +1256,6 @@ fail: sysfs_remove_battery(battery); mutex_destroy(&battery->lock); mutex_destroy(&battery->sysfs_lock); - kfree(battery); return result; } @@ -1279,7 +1278,6 @@ static void acpi_battery_remove(struct acpi_device *device) mutex_destroy(&battery->lock); mutex_destroy(&battery->sysfs_lock); - kfree(battery); } #ifdef CONFIG_PM_SLEEP |
