mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dongliang Mu <mudongliangabcd@gmail.com>
To: Hans de Goede <hdegoede@redhat.com>,
	Mark Gross <markgross@kernel.org>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Irina Tirdea <irina.tirdea@intel.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Dongliang Mu <mudongliangabcd@gmail.com>,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2] driver: pmc_atom: free pmc->regmap when pmc_setup_clks fails
Date: Sun,  5 Dec 2021 16:44:19 +0800	[thread overview]
Message-ID: <20211205084419.2382395-1-mudongliangabcd@gmail.com> (raw)

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@gmail.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


             reply	other threads:[~2021-12-05  8:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-05  8:44 Dongliang Mu [this message]
2021-12-06 14:00 ` Andy Shevchenko
2021-12-06 14:01   ` Andy Shevchenko
2021-12-06 14:09   ` Dongliang Mu
2021-12-06 14:05 ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211205084419.2382395-1-mudongliangabcd@gmail.com \
    --to=mudongliangabcd@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=irina.tirdea@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=sboyd@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®