[PATCH 1/2] platform/x86: asus-wmi: Remove redundant condition

Ethan Tidmore posted 2 patches 6 days, 19 hours ago
[PATCH 1/2] platform/x86: asus-wmi: Remove redundant condition
Posted by Ethan Tidmore 6 days, 19 hours ago
The condition (ctrl_param >= 0) is always true because ctrl_param is an
unsigned integer.

Remove the redundant condition.

Detected by Smatch:
drivers/platform/x86/asus-wmi.c:4427 update_screenpad_bl_status() warn:
always true condition '(ctrl_param >= 0) => (0-u32max >= 0)'


Fixes: 034f5efd362fb ("platform/x86: asus-wmi: adjust screenpad power/brightness handling")
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
---
 drivers/platform/x86/asus-wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 0b87214ddd1b..80144c412b90 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -4424,7 +4424,7 @@ static int update_screenpad_bl_status(struct backlight_device *bd)
 	u32 ctrl_param = bd->props.brightness;
 	int err = 0;
 
-	if (ctrl_param >= 0 && bd->props.power) {
+	if (bd->props.power) {
 		err = asus_wmi_set_devstate(ASUS_WMI_DEVID_SCREENPAD_POWER, 1, NULL);
 		if (err < 0)
 			return err;
-- 
2.53.0
Re: [PATCH 1/2] platform/x86: asus-wmi: Remove redundant condition
Posted by Ilpo Järvinen 2 days, 5 hours ago
On Thu, 26 Mar 2026, Ethan Tidmore wrote:

> The condition (ctrl_param >= 0) is always true because ctrl_param is an
> unsigned integer.
> 
> Remove the redundant condition.
> 
> Detected by Smatch:
> drivers/platform/x86/asus-wmi.c:4427 update_screenpad_bl_status() warn:
> always true condition '(ctrl_param >= 0) => (0-u32max >= 0)'
> 
> 
> Fixes: 034f5efd362fb ("platform/x86: asus-wmi: adjust screenpad power/brightness handling")
> Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
> ---
>  drivers/platform/x86/asus-wmi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index 0b87214ddd1b..80144c412b90 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -4424,7 +4424,7 @@ static int update_screenpad_bl_status(struct backlight_device *bd)
>  	u32 ctrl_param = bd->props.brightness;
>  	int err = 0;
>  
> -	if (ctrl_param >= 0 && bd->props.power) {
> +	if (bd->props.power) {
>  		err = asus_wmi_set_devstate(ASUS_WMI_DEVID_SCREENPAD_POWER, 1, NULL);
>  		if (err < 0)
>  			return err;

I've folded this into the original change.

-- 
 i.