From e7b7fe3f764ecf27a8cba18ec77fa5fccb6943a6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Wei=C3=9Fschuh?= Date: Wed, 4 Sep 2024 09:12:52 +0200 Subject: [PATCH] ACPI: battery: check result of register_pm_notifier() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- drivers/acpi/battery.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); -- 2.47.3