[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250319224410.788273-1-xi.pardee@linux.intel.com>
Date: Wed, 19 Mar 2025 15:44:06 -0700
From: Xi Pardee <xi.pardee@...ux.intel.com>
To: xi.pardee@...ux.intel.com,
irenic.rajneesh@...il.com,
david.e.box@...ux.intel.com,
hdegoede@...hat.com,
ilpo.jarvinen@...ux.intel.com,
platform-driver-x86@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org
Subject: [PATCH] platform/x86: intel/pmc: Fix iounmap call for valid addresses
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@...ux.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
Powered by blists - more mailing lists