From 5db16ea6fc8e3a45a5500876465b49d24c1068f5 Mon Sep 17 00:00:00 2001 From: Jeremy Compostella Date: Wed, 14 Jan 2026 09:08:18 -0800 Subject: [PATCH] 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/90759 Reviewed-by: Guvendik, Bora Reviewed-by: Kim, Wonkyu Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) --- src/soc/intel/pantherlake/tdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/soc/intel/pantherlake/tdp.c b/src/soc/intel/pantherlake/tdp.c index 63b3072499..30b03366fe 100644 --- a/src/soc/intel/pantherlake/tdp.c +++ b/src/soc/intel/pantherlake/tdp.c @@ -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(); }