LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
To: corentin.chary@gmail.com
Cc: hdegoede@redhat.com, mgross@linux.intel.com, jdelvare@suse.com,
	linux@roeck-us.net, acpi4asus-user@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org,
	Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Subject: [PATCH] asus-wmi: Fix "unsigned 'retval' is never less than zero" smatch warning
Date: Wed, 25 Aug 2021 18:37:02 +0800	[thread overview]
Message-ID: <1629887822-23918-1-git-send-email-jiapeng.chong@linux.alibaba.com> (raw)

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


             reply	other threads:[~2021-08-25 10:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-25 10:37 Jiapeng Chong [this message]
2021-08-26 13:15 ` [PATCH] asus-wmi: Fix "unsigned 'retval' is never less than zero" smatch warning 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=1629887822-23918-1-git-send-email-jiapeng.chong@linux.alibaba.com \
    --to=jiapeng.chong@linux.alibaba.com \
    --cc=acpi4asus-user@lists.sourceforge.net \
    --cc=corentin.chary@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mgross@linux.intel.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;
as well as URLs for NNTP newsgroup(s).