Skip to contentSkip to conversation

platform/x86/intel/pmc: initialize empty PMT read result

PATCH In review Yousef Alhouseen 3 participants 3 messages Jun 30 – Jul 21

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86/intel/pmc: initialize empty PMT read result

pmc_core_pmt_get_lpm_req() returns the last telemetry read status. When firmware exposes no enabled low-power modes, the loop does not run and the function returns an uninitialized stack value.

Initialize the status to success so an empty mode set is handled deterministically.

---
 drivers/platform/x86/intel/pmc/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/intel/pmc/core.c +1 -1
index 825ba5fa0bcb..9f77c0716e59 100644
@@ -1583,7 +1583,7 @@ int pmc_core_pmt_get_lpm_req(struct pmc_dev *pmcdev, struct pmc *pmc, struct tel
 {
 	const u8 *lpm_indices;
 	int num_maps, mode_offset = 0;
-	int ret, lpm_size;
+	int ret = 0, lpm_size;
 	u8 mode;
 
 	lpm_indices = pmc->map->lpm_reg_index;
Signature · 1 line
2.54.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 28 lines · Yousef Alhouseen

pmc_core_pmt_get_lpm_req() returns the last telemetry read status. When firmware exposes no enabled low-power modes, the loop does not run and the function returns an uninitialized stack value.

Initialize the status to success so an empty mode set is handled deterministically.

---
 drivers/platform/x86/intel/pmc/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/intel/pmc/core.c +1 -1
index 825ba5fa0bcb..9f77c0716e59 100644
@@ -1583,7 +1583,7 @@ int pmc_core_pmt_get_lpm_req(struct pmc_dev *pmcdev, struct pmc *pmc, struct tel
 {
 	const u8 *lpm_indices;
 	int num_maps, mode_offset = 0;
-	int ret, lpm_size;
+	int ret = 0, lpm_size;
 	u8 mode;
 
 	lpm_indices = pmc->map->lpm_reg_index;
Signature · 1 line
2.54.0

Thanks

maintainer
#2 lore raw
In reply to Yousef Alhouseen
Quoted 8 lines · Yousef Alhouseen

pmc_core_pmt_get_lpm_req() returns the last telemetry read status. When firmware exposes no enabled low-power modes, the loop does not run and the function returns an uninitialized stack value.

Initialize the status to success so an empty mode set is handled deterministically.

[...]

Thank you for your contribution, it has been applied to my local review-ilpo-next branch. Note it will show up in the public platform-drivers-x86/review-ilpo-next branch only once I've pushed my local branch there, which might take a while.

FYI [if applicable to your patch], as per Linus' policy change, also fixes are mostly routed through for-next unless the fix is for a commit introduced in the most recent cycle or is clearly a regression fix.

The list of commits applied:
[1/1] platform/x86/intel/pmc: initialize empty PMT read result

      commit: 408b87a481e3ab33cba00292e4c80a30ba97f995

--
i.