Skip to contentSkip to conversation

thermal: Fix unsigned comparison with less than zero

PATCH Applied Yang Li 3 participants 3 messages Jan 6, 2023 – Jan 12, 2023 Thermal

lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 thermal: Fix unsigned comparison with less than zero

The return value from the call to intel_tcc_get_tjmax() is int, which can be a negative error code. However, the return value is being assigned to an u32 variable 'tj_max', so making 'tj_max' an int.

Eliminate the following warning:
./drivers/thermal/intel/intel_soc_dts_iosf.c:394:5-11: WARNING: Unsigned expression compared with zero: tj_max < 0

---
 drivers/thermal/intel/intel_soc_dts_iosf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/intel/intel_soc_dts_iosf.c +1 -1
index 2138693d8afd..8c26f7b2316b 100644
@@ -380,7 +380,7 @@ struct intel_soc_dts_sensors *intel_soc_dts_iosf_init(
 {
 	struct intel_soc_dts_sensors *sensors;
 	bool notification;
-	u32 tj_max;
+	int tj_max;
 	int ret;
 	int i;
 
Signature · 1 line
2.20.1.7.g153144c
reviewer Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Yang Li

The return value from the call to intel_tcc_get_tjmax() is int, which can
be a negative error code. However, the return value is being assigned to
an u32 variable 'tj_max', so making 'tj_max' an int.

Quoted 7 lines

Eliminate the following warning:
./drivers/thermal/intel/intel_soc_dts_iosf.c:394:5-11: WARNING:
Unsigned expression compared with zero: tj_max < 0

Thanks for catching this issue.

thanks,
rui

Quoted 19 lines
---
 drivers/thermal/intel/intel_soc_dts_iosf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/intel/intel_soc_dts_iosf.c +1 -1
index 2138693d8afd..8c26f7b2316b 100644
@@ -380,7 +380,7 @@ struct intel_soc_dts_sensors
 *intel_soc_dts_iosf_init(
 {
 	struct intel_soc_dts_sensors *sensors;
 	bool notification;
-	u32 tj_max;
+	int tj_max;
 	int ret;
 	int i;
maintainer Applied
#2 lore raw
Quoted 12 lines · Rui
Quoted 10 lines · Yang Li

The return value from the call to intel_tcc_get_tjmax() is int, which can
be a negative error code. However, the return value is being assigned to
an u32 variable 'tj_max', so making 'tj_max' an int.

Eliminate the following warning:
./drivers/thermal/intel/intel_soc_dts_iosf.c:394:5-11: WARNING:
Unsigned expression compared with zero: tj_max < 0

Quoted 7 lines
Quoted 3 lines

Thanks for catching this issue.

Applied, thanks!

Quoted 19 lines
Quoted 19 lines
---
 drivers/thermal/intel/intel_soc_dts_iosf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/intel/intel_soc_dts_iosf.c +1 -1
index 2138693d8afd..8c26f7b2316b 100644
@@ -380,7 +380,7 @@ struct intel_soc_dts_sensors
 *intel_soc_dts_iosf_init(
 {
      struct intel_soc_dts_sensors *sensors;
      bool notification;
-     u32 tj_max;
+     int tj_max;
      int ret;
      int i;