[PATCH] platform/x86: dell-wmi-sysman: correct an initialization failure
From: Mario Limonciello
Date: Thu Feb 18 2021 - 14:48:48 EST
On Dell systems that don't support this interface the module is
mistakingly returning error code "0", when it should be returning
-ENODEV. Correct a logic error to guarantee the correct return code.
Cc: Divya Bharathi <Divya_Bharathi@xxxxxxxx>
Reported-by: Alexander Naumann <alexandernaumann@xxxxxx>
Signed-off-by: Mario Limonciello <mario.limonciello@xxxxxxxx>
---
drivers/platform/x86/dell-wmi-sysman/biosattr-interface.c | 4 +++-
drivers/platform/x86/dell-wmi-sysman/passwordattr-interface.c | 4 +++-
drivers/platform/x86/dell-wmi-sysman/sysman.c | 4 ++--
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/platform/x86/dell-wmi-sysman/biosattr-interface.c b/drivers/platform/x86/dell-wmi-sysman/biosattr-interface.c
index f95d8ddace5a..8d59f81f9db4 100644
--- a/drivers/platform/x86/dell-wmi-sysman/biosattr-interface.c
+++ b/drivers/platform/x86/dell-wmi-sysman/biosattr-interface.c
@@ -175,7 +175,9 @@ static struct wmi_driver bios_attr_set_interface_driver = {
int init_bios_attr_set_interface(void)
{
- return wmi_driver_register(&bios_attr_set_interface_driver);
+ int ret = wmi_driver_register(&bios_attr_set_interface_driver);
+
+ return wmi_priv.bios_attr_wdev ? ret : -ENODEV;
}
void exit_bios_attr_set_interface(void)
diff --git a/drivers/platform/x86/dell-wmi-sysman/passwordattr-interface.c b/drivers/platform/x86/dell-wmi-sysman/passwordattr-interface.c
index 5780b4d94759..bf449dc5ff47 100644
--- a/drivers/platform/x86/dell-wmi-sysman/passwordattr-interface.c
+++ b/drivers/platform/x86/dell-wmi-sysman/passwordattr-interface.c
@@ -142,7 +142,9 @@ static struct wmi_driver bios_attr_pass_interface_driver = {
int init_bios_attr_pass_interface(void)
{
- return wmi_driver_register(&bios_attr_pass_interface_driver);
+ int ret = wmi_driver_register(&bios_attr_pass_interface_driver);
+
+ return wmi_priv.password_attr_wdev ? ret : -ENODEV;
}
void exit_bios_attr_pass_interface(void)
diff --git a/drivers/platform/x86/dell-wmi-sysman/sysman.c b/drivers/platform/x86/dell-wmi-sysman/sysman.c
index cb81010ba1a2..d9ad0e83b66f 100644
--- a/drivers/platform/x86/dell-wmi-sysman/sysman.c
+++ b/drivers/platform/x86/dell-wmi-sysman/sysman.c
@@ -513,13 +513,13 @@ static int __init sysman_init(void)
}
ret = init_bios_attr_set_interface();
- if (ret || !wmi_priv.bios_attr_wdev) {
+ if (ret) {
pr_debug("failed to initialize set interface\n");
goto fail_set_interface;
}
ret = init_bios_attr_pass_interface();
- if (ret || !wmi_priv.password_attr_wdev) {
+ if (ret) {
pr_debug("failed to initialize pass interface\n");
goto fail_pass_interface;
}
--
2.25.1