thermal: intel: hfi: Remove a pointless die_id check

Message ID 20221128162001.31227-1-ricardo.neri-calderon@linux.intel.com
State New
Headers
Series thermal: intel: hfi: Remove a pointless die_id check |

Commit Message

Ricardo Neri Nov. 28, 2022, 4:20 p.m. UTC
  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 <daniel.lezcano@linaro.org>
Cc: Amit Kucheria <amitk@kernel.org>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Aubrey Li <aubrey.li@linux.intel.com>
Cc: Haowen Bai <baihaowen@meizu.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
---
 drivers/thermal/intel/intel_hfi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Rafael J. Wysocki Dec. 2, 2022, 7:48 p.m. UTC | #1
On Mon, Nov 28, 2022 at 5:12 PM Ricardo Neri
<ricardo.neri-calderon@linux.intel.com> wrote:
>
> 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 <daniel.lezcano@linaro.org>
> Cc: Amit Kucheria <amitk@kernel.org>
> Cc: Zhang Rui <rui.zhang@intel.com>
> Cc: Len Brown <len.brown@intel.com>
> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Cc: Aubrey Li <aubrey.li@linux.intel.com>
> Cc: Haowen Bai <baihaowen@meizu.com>
> Cc: linux-pm@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
> ---
>  drivers/thermal/intel/intel_hfi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/intel/intel_hfi.c b/drivers/thermal/intel/intel_hfi.c
> index 239afe02e518..d35287eb2f78 100644
> --- a/drivers/thermal/intel/intel_hfi.c
> +++ b/drivers/thermal/intel/intel_hfi.c
> @@ -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!
  

Patch

diff --git a/drivers/thermal/intel/intel_hfi.c b/drivers/thermal/intel/intel_hfi.c
index 239afe02e518..d35287eb2f78 100644
--- a/drivers/thermal/intel/intel_hfi.c
+++ b/drivers/thermal/intel/intel_hfi.c
@@ -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];