summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2024-09-04 09:12:52 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-10-07 18:45:18 +0200
commite7b7fe3f764ecf27a8cba18ec77fa5fccb6943a6 (patch)
tree74390f7051bcb9dd9945cf64c71f9ee6946732ce
parente1043b6765d6ca310a10be342e25d5451d58ee53 (diff)
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>
-rw-r--r--drivers/acpi/battery.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 65fa3444367a..27a55283d213 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -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);