From: Thomas Weißschuh Date: Wed, 4 Sep 2024 07:12:52 +0000 (+0200) Subject: ACPI: battery: check result of register_pm_notifier() X-Git-Tag: v6.13-rc1~192^2~2^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e7b7fe3f764ecf27a8cba18ec77fa5fccb6943a6;p=thirdparty%2Fkernel%2Flinux.git ACPI: battery: check result of register_pm_notifier() This function call can fail, check for that. Signed-off-by: Thomas Weißschuh Link: https://patch.msgid.link/20240904-acpi-battery-cleanups-v1-1-a3bf74f22d40@weissschuh.net Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 65fa3444367a1..27a55283d2137 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);