linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] platform/x86: thinkpad_acpi: Remove always false 'value < 0' statement
@ 2020-04-29  8:59 Xiongfeng Wang
  2020-04-29 12:35 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Xiongfeng Wang @ 2020-04-29  8:59 UTC (permalink / raw)
  To: ibm-acpi, dvhart, andy, ibm-acpi-devel, platform-driver-x86,
	linux-kernel, wangxiongfeng2

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

So let's remove it.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] platform/x86: thinkpad_acpi: Remove always false 'value < 0' statement
  2020-04-29  8:59 [PATCH] platform/x86: thinkpad_acpi: Remove always false 'value < 0' statement Xiongfeng Wang
@ 2020-04-29 12:35 ` Andy Shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2020-04-29 12:35 UTC (permalink / raw)
  To: Xiongfeng Wang
  Cc: Henrique de Moraes Holschuh, Darren Hart, Andy Shevchenko,
	Thinkpad-acpi devel ML, Platform Driver,
	Linux Kernel Mailing List

On Wed, Apr 29, 2020 at 12:06 PM Xiongfeng Wang
<wangxiongfeng2@huawei.com> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-29 12:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-29  8:59 [PATCH] platform/x86: thinkpad_acpi: Remove always false 'value < 0' statement Xiongfeng Wang
2020-04-29 12:35 ` Andy Shevchenko

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).