Skip to contentSkip to conversation

thermal: intel: hfi: Remove a pointless die_id check

PATCH Applied Ricardo Neri 2 participants 2 messages Nov 28, 2022 – Dec 2, 2022 Thermal

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: intel: hfi: Remove a pointless die_id check

die_id is an u16 quantity. On single-die systems the default value of die_id is 0. No need to check for negative values.

Plus, removing this check makes Coverity happy.

Cc Daniel Lezcano <[email protected]>
Cc Amit Kucheria <[email protected]>
Cc Zhang Rui <[email protected]>
Cc Len Brown <[email protected]>
Cc Srinivas Pandruvada <[email protected]>
Cc Aubrey Li <[email protected]>
Cc Haowen Bai <[email protected]>
---
 drivers/thermal/intel/intel_hfi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/intel/intel_hfi.c +1 -1
index 239afe02e518..d35287eb2f78 100644
@@ -371,7 +371,7 @@ void intel_hfi_online(unsigned int cpu)
 	die_id = topology_logical_die_id(cpu);
 	hfi_instance = info->hfi_instance;
 	if (!hfi_instance) {
-		if (die_id < 0 || die_id >= max_hfi_instances)
+		if (die_id >= max_hfi_instances)
 			return;
 
 		hfi_instance = &hfi_instances[die_id];
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw
Quoted 25 lines · Ricardo Neri

die_id is an u16 quantity. On single-die systems the default value of die_id is 0. No need to check for negative values.

Plus, removing this check makes Coverity happy.

Cc Daniel Lezcano <[email protected]>
Cc Amit Kucheria <[email protected]>
Cc Zhang Rui <[email protected]>
Cc Len Brown <[email protected]>
Cc Srinivas Pandruvada <[email protected]>
Cc Aubrey Li <[email protected]>
Cc Haowen Bai <[email protected]>
---
 drivers/thermal/intel/intel_hfi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/intel/intel_hfi.c +0 -0
index 239afe02e518..d35287eb2f78 100644

drivers/thermal/intel/intel_hfi.c void intel_hfi_online(unsigned int cpu)

Quoted 9 lines
drivers/thermal/intel/intel_hfi.c +1 -2
@@ -371,7 +371,7 @@ void intel_hfi_online(unsigned int cpu)
        die_id = topology_logical_die_id(cpu);
        hfi_instance = info->hfi_instance;
        if (!hfi_instance) {
-               if (die_id < 0 || die_id >= max_hfi_instances)
+               if (die_id >= max_hfi_instances)
                        return;
 
                hfi_instance = &hfi_instances[die_id];
--

Applied as 6.2 material, thanks!