soc/intel/pantherlake: Fix incorrect use of logical OR for TDP selection

The previous implementation used the logical OR (||) operator to select
between config->tdp and get_cpu_tdp(). In C, the || operator returns a
boolean value (0 or 1), not the value of the first true operand. This
caused the function to return incorrect TDP values.

This commit replaces the logical OR with the ternary operator (?:),
ensuring that config->tdp is returned if it is non-zero; otherwise,
get_cpu_tdp() is used. This change restores the intended behavior of
selecting the correct TDP value.

TEST=The power map is properly found and applied on a Panther Lake B005
     SoC.

Change-Id: I3a02f804510f87cb4d28bd929869570c355c5242
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90759
Reviewed-by: Guvendik, Bora <bora.guvendik@intel.com>
Reviewed-by: Kim, Wonkyu <wonkyu.kim@intel.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Jeremy Compostella 2026-01-14 09:08:18 -08:00 committed by Jérémy Compostella
commit 5db16ea6fc

View file

@ -21,5 +21,5 @@ enum soc_intel_pantherlake_cpu_tdps soc_get_cpu_tdp(void)
}
const struct soc_intel_pantherlake_config *config = config_of_soc();
return config->tdp || get_cpu_tdp();
return config->tdp ? : get_cpu_tdp();
}