Skip to content

Commit 1d7461d

Browse files
debox1ij-intel
authored andcommitted
platform/x86: intel/pmc: Fix ioremap() of bad address
In pmc_core_ssram_get_pmc(), the physical addresses for hidden SSRAM devices are retrieved from the MMIO region of the primary SSRAM device. If additional devices are not present, the address returned is zero. Currently, the code does not check for this condition, resulting in ioremap() incorrectly attempting to map address 0. Add a check for a zero address and return 0 if no additional devices are found, as it is not an error for the device to be absent. Fixes: a01486d ("platform/x86/intel/pmc: Cleanup SSRAM discovery") Signed-off-by: David E. Box <david.e.box@linux.intel.com> Link: https://lore.kernel.org/r/20250106174653.1497128-1-david.e.box@linux.intel.com Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1 parent cc1ff7b commit 1d7461d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/platform/x86/intel/pmc/core_ssram.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,12 @@ pmc_core_ssram_get_pmc(struct pmc_dev *pmcdev, int pmc_idx, u32 offset)
269269
/*
270270
* The secondary PMC BARS (which are behind hidden PCI devices)
271271
* are read from fixed offsets in MMIO of the primary PMC BAR.
272+
* If a device is not present, the value will be 0.
272273
*/
273274
ssram_base = get_base(tmp_ssram, offset);
275+
if (!ssram_base)
276+
return 0;
277+
274278
ssram = ioremap(ssram_base, SSRAM_HDR_SIZE);
275279
if (!ssram)
276280
return -ENOMEM;

0 commit comments

Comments
 (0)