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>
This commit is contained in:
Thomas Weißschuh
2024-10-07 18:45:18 +02:00
committed by Rafael J. Wysocki
parent e1043b6765
commit e7b7fe3f76
+3 -1
View File
@@ -1238,7 +1238,9 @@ static int acpi_battery_add(struct acpi_device *device)
device->status.battery_present ? "present" : "absent");
battery->pm_nb.notifier_call = battery_notify;
register_pm_notifier(&battery->pm_nb);
result = register_pm_notifier(&battery->pm_nb);
if (result)
goto fail;
device_init_wakeup(&device->dev, 1);