From: Hans de Goede <hdegoede@redhat.com>
To: trix@redhat.com, hmh@hmh.eng.br, markgross@kernel.org,
nathan@kernel.org, ndesaulniers@google.com
Cc: ibm-acpi-devel@lists.sourceforge.net,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH] platform/x86: thinkpad_acpi: consistently check fan_get_status return.
Date: Thu, 17 Mar 2022 11:36:34 +0100 [thread overview]
Message-ID: <a3f2a34a-1abf-76d5-967f-b41f4c135951@redhat.com> (raw)
In-Reply-To: <20220312145327.1398510-1-trix@redhat.com>
Hi,
On 3/12/22 15:53, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
>
> Clang static analysis returns this false positive
> thinkpad_acpi.c:8926:19: warning: The left operand
> of '!=' is a garbage value
> (status != 0) ? "enabled" : "disabled", status);
> ~~~~~~ ^
>
> The return of fan_get_status* is checked inconsistenly.
> Sometime ret < 0 is an error, sometimes !ret.
> Both fan_get_status() and fan_get_status_safe() return
> 0 on success and return negative otherwise. Change
> the checks for error, ret < 0, into checks for
> not success, !ret.
>
> Signed-off-by: Tom Rix <trix@redhat.com>
Thank you for your patch, I've applied this patch to my review-hans
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.
Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.
Regards,
Hans
> ---
> drivers/platform/x86/thinkpad_acpi.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
> index 708743ec9ae79..c568fae56db29 100644
> --- a/drivers/platform/x86/thinkpad_acpi.c
> +++ b/drivers/platform/x86/thinkpad_acpi.c
> @@ -8285,7 +8285,7 @@ static int fan_set_enable(void)
> case TPACPI_FAN_WR_ACPI_FANS:
> case TPACPI_FAN_WR_TPEC:
> rc = fan_get_status(&s);
> - if (rc < 0)
> + if (rc)
> break;
>
> /* Don't go out of emergency fan mode */
> @@ -8304,7 +8304,7 @@ static int fan_set_enable(void)
>
> case TPACPI_FAN_WR_ACPI_SFAN:
> rc = fan_get_status(&s);
> - if (rc < 0)
> + if (rc)
> break;
>
> s &= 0x07;
> @@ -8843,7 +8843,7 @@ static void fan_suspend(void)
> /* Store fan status in cache */
> fan_control_resume_level = 0;
> rc = fan_get_status_safe(&fan_control_resume_level);
> - if (rc < 0)
> + if (rc)
> pr_notice("failed to read fan level for later restore during resume: %d\n",
> rc);
>
> @@ -8864,7 +8864,7 @@ static void fan_resume(void)
>
> if (!fan_control_allowed ||
> !fan_control_resume_level ||
> - (fan_get_status_safe(¤t_level) < 0))
> + fan_get_status_safe(¤t_level))
> return;
>
> switch (fan_control_access_mode) {
> @@ -8918,7 +8918,7 @@ static int fan_read(struct seq_file *m)
> case TPACPI_FAN_RD_ACPI_GFAN:
> /* 570, 600e/x, 770e, 770x */
> rc = fan_get_status_safe(&status);
> - if (rc < 0)
> + if (rc)
> return rc;
>
> seq_printf(m, "status:\t\t%s\n"
> @@ -8929,7 +8929,7 @@ static int fan_read(struct seq_file *m)
> case TPACPI_FAN_RD_TPEC:
> /* all except 570, 600e/x, 770e, 770x */
> rc = fan_get_status_safe(&status);
> - if (rc < 0)
> + if (rc)
> return rc;
>
> seq_printf(m, "status:\t\t%s\n",
prev parent reply other threads:[~2022-03-17 10:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-12 14:53 trix
2022-03-17 10:36 ` Hans de Goede [this message]
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=a3f2a34a-1abf-76d5-967f-b41f4c135951@redhat.com \
--to=hdegoede@redhat.com \
--cc=hmh@hmh.eng.br \
--cc=ibm-acpi-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=markgross@kernel.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=trix@redhat.com \
/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
all inboxes | Powered by JetHome®