[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211205084419.2382395-1-mudongliangabcd@gmail.com>
Date: Sun, 5 Dec 2021 16:44:19 +0800
From: Dongliang Mu <mudongliangabcd@...il.com>
To: Hans de Goede <hdegoede@...hat.com>,
Mark Gross <markgross@...nel.org>,
Stephen Boyd <sboyd@...eaurora.org>,
Irina Tirdea <irina.tirdea@...el.com>,
Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Dongliang Mu <mudongliangabcd@...il.com>,
platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH v2] driver: pmc_atom: free pmc->regmap when pmc_setup_clks fails
Smatch reports:
drivers/platform/x86/pmc_atom.c:496
pmc_setup_dev() warn: 'pmc->regmap' not released on lines: 496.
Fix this by deallocating pm->regmap when pmc_setup_clks fails.
Fixes: 282a4e4ce5f9("platform/x86: Enable Atom PMC platform clocks")
Signed-off-by: Dongliang Mu <mudongliangabcd@...il.com>
---
drivers/platform/x86/pmc_atom.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/pmc_atom.c b/drivers/platform/x86/pmc_atom.c
index a9d2a4b98e57..e338c1572237 100644
--- a/drivers/platform/x86/pmc_atom.c
+++ b/drivers/platform/x86/pmc_atom.c
@@ -488,9 +488,11 @@ static int pmc_setup_dev(struct pci_dev *pdev, const struct pci_device_id *ent)
/* Register platform clocks - PMC_PLT_CLK [0..5] */
ret = pmc_setup_clks(pdev, pmc->regmap, data);
- if (ret)
+ if (ret) {
+ iounmap(pmc->regmap);
dev_warn(&pdev->dev, "platform clocks register failed: %d\n",
ret);
+ }
pmc->init = true;
return ret;
--
2.25.1
Powered by blists - more mailing lists