public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
To: Armin Wolf <W_Armin@gmx.de>,
	hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com
Cc: rafael@kernel.org, lenb@kernel.org, mario.limonciello@amd.com,
	linux-acpi@vger.kernel.org, platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/2] platform/x86: wmi: Avoid returning AE_OK upon unknown error
Date: Sat, 9 Mar 2024 09:41:43 -0800	[thread overview]
Message-ID: <42aa0678-4472-4964-b84e-33beb0a23058@linux.intel.com> (raw)
In-Reply-To: <20240308210519.2986-2-W_Armin@gmx.de>


On 3/8/24 1:05 PM, Armin Wolf wrote:
> If an error code other than EINVAL, ENODEV or ETIME is returned
> by ec_read()/ec_write(), then AE_OK is wrongly returned.
>
> Fix this by only returning AE_OK if the return code is 0, and
> return AE_ERROR otherwise.
>
> Tested on a Dell Inspiron 3505 and a Asus Prime B650-Plus.
>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> Signed-off-by: Armin Wolf <W_Armin@gmx.de>
> ---
>  drivers/platform/x86/wmi.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
> index d9bf6d452b3a..84d1ccf6bc14 100644
> --- a/drivers/platform/x86/wmi.c
> +++ b/drivers/platform/x86/wmi.c
> @@ -1218,8 +1218,10 @@ acpi_wmi_ec_space_handler(u32 function, acpi_physical_address address,
>  		return AE_NOT_FOUND;
>  	case -ETIME:
>  		return AE_TIME;
> -	default:
> +	case 0:
>  		return AE_OK;
> +	default:
> +		return AE_ERROR;
>  	}

After checking the callers of acpi_wmi_ec_space_handler() it looks like there is no benefit in returning different ACPI status per error values. It is not being used. why no just return for result < 0 AE_ERROR and return for other cases?
>  }
>
> --
> 2.39.2
>
>
-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer


  reply	other threads:[~2024-03-09 17:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-08 21:05 [PATCH v4 1/2] platform/x86: wmi: Support reading/writing 16 bit EC values Armin Wolf
2024-03-08 21:05 ` [PATCH v4 2/2] platform/x86: wmi: Avoid returning AE_OK upon unknown error Armin Wolf
2024-03-09 17:41   ` Kuppuswamy Sathyanarayanan [this message]
2024-03-09 19:10     ` Armin Wolf
2024-03-10  2:41       ` Kuppuswamy Sathyanarayanan
2024-03-10 20:57   ` Kuppuswamy Sathyanarayanan
2024-03-09 17:07 ` [PATCH v4 1/2] platform/x86: wmi: Support reading/writing 16 bit EC values Kuppuswamy Sathyanarayanan
2024-03-09 19:17   ` Armin Wolf
2024-03-10  2:39     ` Kuppuswamy Sathyanarayanan
2024-03-10  6:27       ` Armin Wolf
2024-03-11 14:03 ` Ilpo Järvinen

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=42aa0678-4472-4964-b84e-33beb0a23058@linux.intel.com \
    --to=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=W_Armin@gmx.de \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox