From: Hans de Goede <hdegoede@redhat.com>
To: Jelle van der Waa <jvanderwaa@redhat.com>,
Henrique de Moraes Holschuh <hmh@hmh.eng.br>,
Mark Gross <markgross@kernel.org>,
"platform-driver-x86@vger.kernel.org"
<platform-driver-x86@vger.kernel.org>
Cc: Mark Pearson <markpearson@lenovo.com>
Subject: Re: [PATCH 1/1] platform/x86: thinkpad_acpi: skip invalid fan speed
Date: Sat, 15 Oct 2022 16:22:03 +0200 [thread overview]
Message-ID: <5649310a-b91b-986a-3dd3-c4b04f03462e@redhat.com> (raw)
In-Reply-To: <20221014211709.6322-2-jvanderwaa@redhat.com>
Hi,
On 10/14/22 23:17, Jelle van der Waa wrote:
> 65535 is most likely an invalid read.
I wonder if it is an invalid read, or if it actually is a reserved value
which means "FAN_NOT_PRESENT"
I'm tempted to add:
#define FAN_NOT_PRESENT 65535
and then change the check to:
if (res >= 0 && speed != FAN_NOT_PRESENT) {
That would make the code more logical to read.
Jelle, can you make this change for v2 ? Also please Cc: platform-driver-x86@vger.kernel.org
for v2.
Mark, what do you think of this change (and of adding the
FAN_NOT_PRESENT define) ?
Regards,
Hans
>
> Signed-off-by: Jelle van der Waa <jvanderwaa@redhat.com>
>
> ---
>
> Cc: Mark Pearson <markpearson@lenovo.com>
> ---
> drivers/platform/x86/thinkpad_acpi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
> index 6a823b850a77..7e0f72dc53b7 100644
> --- a/drivers/platform/x86/thinkpad_acpi.c
> +++ b/drivers/platform/x86/thinkpad_acpi.c
> @@ -8876,7 +8876,7 @@ static int __init fan_init(struct ibm_init_struct *iibm)
> /* Try and probe the 2nd fan */
> tp_features.second_fan = 1; /* needed for get_speed to work */
> res = fan2_get_speed(&speed);
> - if (res >= 0) {
> + if (res >= 0 && speed != 65535) {
> /* It responded - so let's assume it's there */
> tp_features.second_fan = 1;
> tp_features.second_fan_ctl = 1;
next parent reply other threads:[~2022-10-15 14:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20221014211709.6322-1-jvanderwaa@redhat.com>
[not found] ` <20221014211709.6322-2-jvanderwaa@redhat.com>
2022-10-15 14:22 ` Hans de Goede [this message]
2022-10-17 20:05 ` [External] Re: [PATCH 1/1] platform/x86: thinkpad_acpi: skip invalid fan speed Mark Pearson
2022-10-19 19:47 ` [PATCH] " Jelle van der Waa
2022-10-24 9:25 ` 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=5649310a-b91b-986a-3dd3-c4b04f03462e@redhat.com \
--to=hdegoede@redhat.com \
--cc=hmh@hmh.eng.br \
--cc=jvanderwaa@redhat.com \
--cc=markgross@kernel.org \
--cc=markpearson@lenovo.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox