LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] asus-wmi: Fix "unsigned 'retval' is never less than zero" smatch warning
@ 2021-08-25 10:37 Jiapeng Chong
2021-08-26 13:15 ` Hans de Goede
0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2021-08-25 10:37 UTC (permalink / raw)
To: corentin.chary
Cc: hdegoede, mgross, jdelvare, linux, acpi4asus-user, linux-kernel,
linux-hwmon, Jiapeng Chong
Eliminate the follow smatch warnings:
drivers/platform/x86/asus-wmi.c:478 panel_od_write() warn: unsigned
'retval' is never less than zero.
drivers/platform/x86/asus-wmi.c:566 panel_od_write() warn: unsigned
'retval' is never less than zero.
drivers/platform/x86/asus-wmi.c:1451 panel_od_write() warn: unsigned
'retval' is never less than zero.
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Fixes: 98829e84dc67 ("asus-wmi: Add dgpu disable method")
Fixes: 382b91db8044 ("asus-wmi: Add egpu enable method")
Fixes: ca91ea34778f ("asus-wmi: Add panel overdrive functionality")
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
drivers/platform/x86/asus-wmi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index cc58118..22af431 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -475,7 +475,7 @@ static int dgpu_disable_write(struct asus_wmi *asus)
return err;
}
- if (retval > 1 || retval < 0) {
+ if (retval > 1) {
pr_warn("Failed to set dgpu disable (retval): 0x%x\n", retval);
return -EIO;
}
@@ -563,7 +563,7 @@ static int egpu_enable_write(struct asus_wmi *asus)
return err;
}
- if (retval > 1 || retval < 0) {
+ if (retval > 1) {
pr_warn("Failed to set egpu disable (retval): 0x%x\n", retval);
return -EIO;
}
@@ -1448,7 +1448,7 @@ static int panel_od_write(struct asus_wmi *asus)
return err;
}
- if (retval > 1 || retval < 0) {
+ if (retval > 1) {
pr_warn("Failed to set panel overdrive (retval): 0x%x\n", retval);
return -EIO;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] asus-wmi: Fix "unsigned 'retval' is never less than zero" smatch warning
2021-08-25 10:37 [PATCH] asus-wmi: Fix "unsigned 'retval' is never less than zero" smatch warning Jiapeng Chong
@ 2021-08-26 13:15 ` Hans de Goede
0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2021-08-26 13:15 UTC (permalink / raw)
To: Jiapeng Chong, corentin.chary
Cc: mgross, jdelvare, linux, acpi4asus-user, linux-kernel, linux-hwmon
Hi,
On 8/25/21 12:37 PM, Jiapeng Chong wrote:
> Eliminate the follow smatch warnings:
>
> drivers/platform/x86/asus-wmi.c:478 panel_od_write() warn: unsigned
> 'retval' is never less than zero.
>
> drivers/platform/x86/asus-wmi.c:566 panel_od_write() warn: unsigned
> 'retval' is never less than zero.
>
> drivers/platform/x86/asus-wmi.c:1451 panel_od_write() warn: unsigned
> 'retval' is never less than zero.
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Fixes: 98829e84dc67 ("asus-wmi: Add dgpu disable method")
> Fixes: 382b91db8044 ("asus-wmi: Add egpu enable method")
> Fixes: ca91ea34778f ("asus-wmi: Add panel overdrive functionality")
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.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/asus-wmi.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index cc58118..22af431 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -475,7 +475,7 @@ static int dgpu_disable_write(struct asus_wmi *asus)
> return err;
> }
>
> - if (retval > 1 || retval < 0) {
> + if (retval > 1) {
> pr_warn("Failed to set dgpu disable (retval): 0x%x\n", retval);
> return -EIO;
> }
> @@ -563,7 +563,7 @@ static int egpu_enable_write(struct asus_wmi *asus)
> return err;
> }
>
> - if (retval > 1 || retval < 0) {
> + if (retval > 1) {
> pr_warn("Failed to set egpu disable (retval): 0x%x\n", retval);
> return -EIO;
> }
> @@ -1448,7 +1448,7 @@ static int panel_od_write(struct asus_wmi *asus)
> return err;
> }
>
> - if (retval > 1 || retval < 0) {
> + if (retval > 1) {
> pr_warn("Failed to set panel overdrive (retval): 0x%x\n", retval);
> return -EIO;
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-26 13:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-25 10:37 [PATCH] asus-wmi: Fix "unsigned 'retval' is never less than zero" smatch warning Jiapeng Chong
2021-08-26 13:15 ` Hans de Goede
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).