2020-04-29 09:07:57

by Xiongfeng Wang

[permalink] [raw]
Subject: [PATCH] platform/x86: thinkpad_acpi: Remove always false 'value < 0' statement

Since 'value' is declared as unsigned long, the following statement is
always false.
value < 0

So let's remove it.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Xiongfeng Wang <[email protected]>
---
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 8eaadba..0f70448 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -9548,7 +9548,7 @@ static ssize_t tpacpi_battery_store(int what,
if (!battery_info.batteries[battery].start_support)
return -ENODEV;
/* valid values are [0, 99] */
- if (value < 0 || value > 99)
+ if (value > 99)
return -EINVAL;
if (value > battery_info.batteries[battery].charge_stop)
return -EINVAL;
--
1.7.12.4


2020-04-29 12:38:28

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH] platform/x86: thinkpad_acpi: Remove always false 'value < 0' statement

On Wed, Apr 29, 2020 at 12:06 PM Xiongfeng Wang
<[email protected]> wrote:
>
> Since 'value' is declared as unsigned long, the following statement is
> always false.
> value < 0
>
> So let's remove it.

It's bogus. The warning here doesn't tell anything useful, so doesn't the patch.

--
With Best Regards,
Andy Shevchenko