All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform/x86: intel/pmc: Fix iounmap call for valid addresses
@ 2025-03-19 22:44 Xi Pardee
  2025-03-21 14:49 ` Ilpo Järvinen
  0 siblings, 1 reply; 3+ messages in thread
From: Xi Pardee @ 2025-03-19 22:44 UTC (permalink / raw)
  To: xi.pardee, irenic.rajneesh, david.e.box, hdegoede, ilpo.jarvinen,
	platform-driver-x86, linux-kernel, linux-pm

pmc_core_clean_structure() is called when generic_core_init() fails.
generic_core_init() could fail before ioremap() is called to get
a valid regbase for pmc structure. The current code does not check
regbase before calling iounmap(). Add a check to fix it.

Fixes: 1b8c7b843c00 ("platform/x86:intel/pmc: Discover PMC devices")
Signed-off-by: Xi Pardee <xi.pardee@linux.intel.com>
---
 drivers/platform/x86/intel/pmc/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c
index 7a1d11f2914f..de5fc06232e5 100644
--- a/drivers/platform/x86/intel/pmc/core.c
+++ b/drivers/platform/x86/intel/pmc/core.c
@@ -1471,7 +1471,7 @@ static void pmc_core_clean_structure(struct platform_device *pdev)
 	for (i = 0; i < ARRAY_SIZE(pmcdev->pmcs); ++i) {
 		struct pmc *pmc = pmcdev->pmcs[i];
 
-		if (pmc)
+		if (pmc && pmc->regbase)
 			iounmap(pmc->regbase);
 	}
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-03-24 20:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-19 22:44 [PATCH] platform/x86: intel/pmc: Fix iounmap call for valid addresses Xi Pardee
2025-03-21 14:49 ` Ilpo Järvinen
2025-03-24 20:54   ` Xi Pardee

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.