]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ACPI: battery: check result of register_pm_notifier()
authorThomas Weißschuh <linux@weissschuh.net>
Wed, 4 Sep 2024 07:12:52 +0000 (09:12 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 7 Oct 2024 16:45:18 +0000 (18:45 +0200)
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>
drivers/acpi/battery.c

index 65fa3444367a13ac83644444076a11f08152c382..27a55283d213764fd1e40f7a8b60d9ebe7e11662 100644 (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);