lkml.org 
[lkml]   [2019]   [May]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH][next] drivers: thermal: tsens: remove redundant u32 comparison with less than zero
Date
From: Colin Ian King <colin.king@canonical.com>

The u32 variable hw_id is unsigned and cannot be less than zero so
the comparison with less than zero is always false and hence is redundant
and can be removed.

Addresses-Coverity: ("Unsigned compared against 0")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/thermal/qcom/tsens-common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c
index 928e8e81ba69..f4419f45025d 100644
--- a/drivers/thermal/qcom/tsens-common.c
+++ b/drivers/thermal/qcom/tsens-common.c
@@ -69,7 +69,7 @@ bool is_sensor_enabled(struct tsens_priv *priv, u32 hw_id)
u32 val;
int ret;

- if ((hw_id > (priv->num_sensors - 1)) || (hw_id < 0))
+ if (hw_id > (priv->num_sensors - 1))
return -EINVAL;
ret = regmap_field_read(priv->rf[SENSOR_EN], &val);
if (ret)
--
2.20.1
\
 
 \ /
  Last update: 2019-05-31 12:58    [W:0.037 / U:1.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site