Skip to content

Commit e7b7fe3

Browse files
t-8chrafaeljw
authored andcommitted
ACPI: battery: check result of register_pm_notifier()
This function call can fail, check for that. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://patch.msgid.link/20240904-acpi-battery-cleanups-v1-1-a3bf74f22d40@weissschuh.net Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent e1043b6 commit e7b7fe3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/acpi/battery.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1238,7 +1238,9 @@ static int acpi_battery_add(struct acpi_device *device)
12381238
device->status.battery_present ? "present" : "absent");
12391239

12401240
battery->pm_nb.notifier_call = battery_notify;
1241-
register_pm_notifier(&battery->pm_nb);
1241+
result = register_pm_notifier(&battery->pm_nb);
1242+
if (result)
1243+
goto fail;
12421244

12431245
device_init_wakeup(&device->dev, 1);
12441246

0 commit comments

Comments
 (0)