summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorArmin Wolf <W_Armin@gmx.de>2024-01-03 20:27:05 +0100
committerHans de Goede <hdegoede@redhat.com>2024-01-22 11:34:30 +0100
commit3d8a29fec2cb96b3aa75a595f20c4b73ff294a97 (patch)
tree2225718860c351ae0a3d23b95c7277697206f833 /drivers
parentplatform/x86: wmi: Fix error handling in legacy WMI notify handler functions (diff)
downloadlinux-3d8a29fec2cb96b3aa75a595f20c4b73ff294a97.tar.xz
linux-3d8a29fec2cb96b3aa75a595f20c4b73ff294a97.zip
platform/x86: wmi: Return immediately if an suitable WMI event is found
Commit 58f6425eb92f ("WMI: Cater for multiple events with same GUID") allowed legacy WMI notify handlers to be installed for multiple WMI devices with the same GUID. However this is useless since the legacy GUID-based interface is blacklisted from seeing WMI devices with duplicated GUIDs. Return immediately if a suitable WMI event is found in wmi_install/remove_notify_handler() since searching for other suitable events is pointless. Tested on a Dell Inspiron 3505 and a Acer Aspire E1-731. Signed-off-by: Armin Wolf <W_Armin@gmx.de> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20240103192707.115512-3-W_Armin@gmx.de Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/platform/x86/wmi.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 23b4043c0fe7..4e2d0e15b155 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -573,7 +573,6 @@ acpi_status wmi_install_notify_handler(const char *guid,
void *data)
{
struct wmi_block *block;
- acpi_status status = AE_NOT_EXIST;
guid_t guid_input;
if (!guid || !handler)
@@ -596,11 +595,11 @@ acpi_status wmi_install_notify_handler(const char *guid,
if (ACPI_FAILURE(wmi_status))
dev_warn(&block->dev.dev, "Failed to enable device\n");
- status = AE_OK;
+ return AE_OK;
}
}
- return status;
+ return AE_NOT_EXIST;
}
EXPORT_SYMBOL_GPL(wmi_install_notify_handler);
@@ -615,7 +614,6 @@ EXPORT_SYMBOL_GPL(wmi_install_notify_handler);
acpi_status wmi_remove_notify_handler(const char *guid)
{
struct wmi_block *block;
- acpi_status status = AE_NOT_EXIST;
guid_t guid_input;
if (!guid)
@@ -638,11 +636,11 @@ acpi_status wmi_remove_notify_handler(const char *guid)
block->handler = NULL;
block->handler_data = NULL;
- status = AE_OK;
+ return AE_OK;
}
}
- return status;
+ return AE_NOT_EXIST;
}
EXPORT_SYMBOL_GPL(wmi_remove_notify_handler);