From: Thomas Renninger Date: Tue, 20 Jul 2010 22:19:29 +0000 (-0700) Subject: hp-wmi: return -ENODEV if BIOS does not export any supported hp wmi guid X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b096667bc3f01e2468df56d4a241dc5231b2f2aa;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git hp-wmi: return -ENODEV if BIOS does not export any supported hp wmi guid Signed-off-by: Thomas Renninger Cc: Matthew Garrett Cc: Len Brown Cc: Axel Lin Signed-off-by: Andrew Morton Signed-off-by: Matthew Garrett --- diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index d55bf58ce8f9..34b417848e29 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c @@ -711,8 +711,10 @@ static int hp_wmi_resume_handler(struct device *device) static int __init hp_wmi_init(void) { int err; + int event_capable = wmi_has_guid(HPWMI_EVENT_GUID); + int bios_capable = wmi_has_guid(HPWMI_BIOS_GUID); - if (wmi_has_guid(HPWMI_EVENT_GUID)) { + if (event_capable) { err = wmi_install_notify_handler(HPWMI_EVENT_GUID, hp_wmi_notify, NULL); if (ACPI_FAILURE(err)) @@ -724,7 +726,7 @@ static int __init hp_wmi_init(void) } } - if (wmi_has_guid(HPWMI_BIOS_GUID)) { + if (bios_capable) { err = platform_driver_register(&hp_wmi_driver); if (err) goto err_driver_reg; @@ -738,6 +740,9 @@ static int __init hp_wmi_init(void) goto err_device_add; } + if (!bios_capable && !event_capable) + return -ENODEV; + return 0; err_device_add: