From: mark gross <mgross@linux.intel.com>
To: Mario Limonciello <mario.limonciello@dell.com>
Cc: Hans De Goede <hdegoede@redhat.com>,
Mark Gross <mgross@linux.intel.com>,
LKML <linux-kernel@vger.kernel.org>,
platform-driver-x86@vger.kernel.org,
Divya Bharathi <Divya.Bharathi@Dell.com>,
Alexander Naumann <alexandernaumann@gmx.de>
Subject: Re: [PATCH] platform/x86: dell-wmi-sysman: correct an initialization failure
Date: Thu, 18 Feb 2021 14:48:48 -0800 [thread overview]
Message-ID: <20210218224848.GB134379@linux.intel.com> (raw)
In-Reply-To: <20210218191723.20030-1-mario.limonciello@dell.com>
On Thu, Feb 18, 2021 at 01:17:23PM -0600, Mario Limonciello wrote:
> 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@Dell.com>
> Reported-by: Alexander Naumann <alexandernaumann@gmx.de>
> Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
> ---
> 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);
I have to ask if the propper fix should be in wmi_driver_register
> +
> + return wmi_priv.bios_attr_wdev ? ret : -ENODEV;
Also, is there any point to call wmi_driver_register if returning -ENODEV?
i.e. should the call to driver register be wrapped in a test for
bios_atter_wdev?
> }
>
> 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;
same comments as above only for password_atter_wdev.
--mark
> }
>
> 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
>
next prev parent reply other threads:[~2021-02-18 22:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-18 19:17 [PATCH] platform/x86: dell-wmi-sysman: correct an initialization failure Mario Limonciello
2021-02-18 22:48 ` mark gross [this message]
2021-02-18 23:26 ` Limonciello, Mario
2021-02-19 10:42 ` Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210218224848.GB134379@linux.intel.com \
--to=mgross@linux.intel.com \
--cc=Divya.Bharathi@Dell.com \
--cc=alexandernaumann@gmx.de \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@dell.com \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.