aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRajvi Jingar <rajvi.jingar@linux.intel.com>2023-12-15 17:16:50 -0800
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2023-12-18 14:45:32 +0200
commitfbcf67ce5a9e2831c14bdfb895be05213e611724 (patch)
tree529570aab95484506d1aacde0a8aa83ca39e244c
parent66e92e23a72761f5b53f970aeb1badc5fd92fc74 (diff)
downloadlinux-fbcf67ce5a9e2831c14bdfb895be05213e611724.tar.gz
platform/x86/intel/pmc: Fix hang in pmc_core_send_ltr_ignore()
For input value 0, PMC stays unassigned which causes crash while trying to access PMC for register read/write. Include LTR index 0 in pmc_index and ltr_index calculation. Fixes: 2bcef4529222 ("platform/x86:intel/pmc: Enable debugfs multiple PMC support") Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20231216011650.1973941-1-rajvi.jingar@linux.intel.com Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
-rw-r--r--drivers/platform/x86/intel/pmc/core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c
index 84c175b9721a0b..e95d3011b9997d 100644
--- a/drivers/platform/x86/intel/pmc/core.c
+++ b/drivers/platform/x86/intel/pmc/core.c
@@ -472,7 +472,7 @@ int pmc_core_send_ltr_ignore(struct pmc_dev *pmcdev, u32 value)
* is based on the contiguous indexes from ltr_show output.
* pmc index and ltr index needs to be calculated from it.
*/
- for (pmc_index = 0; pmc_index < ARRAY_SIZE(pmcdev->pmcs) && ltr_index > 0; pmc_index++) {
+ for (pmc_index = 0; pmc_index < ARRAY_SIZE(pmcdev->pmcs) && ltr_index >= 0; pmc_index++) {
pmc = pmcdev->pmcs[pmc_index];
if (!pmc)