All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>
Cc: linux-tegra@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, Peter Geis <pgwipeout@gmail.com>
Subject: [PATCH v2 05/11] cpufreq: tegra20: Release clocks properly
Date: Fri, 18 May 2018 23:06:36 +0300	[thread overview]
Message-ID: <20180518200642.24815-6-digetx@gmail.com> (raw)
In-Reply-To: <20180518200642.24815-1-digetx@gmail.com>

Properly put requested clocks in the module init/exit code.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Thierry Reding <treding@nvidia.com>
---
 drivers/cpufreq/tegra20-cpufreq.c | 31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/drivers/cpufreq/tegra20-cpufreq.c b/drivers/cpufreq/tegra20-cpufreq.c
index 4b09a8b410c4..ea186d3f0faf 100644
--- a/drivers/cpufreq/tegra20-cpufreq.c
+++ b/drivers/cpufreq/tegra20-cpufreq.c
@@ -161,24 +161,45 @@ static struct cpufreq_driver tegra_cpufreq_driver = {
 
 static int __init tegra_cpufreq_init(void)
 {
+	int err;
+
 	cpu_clk = clk_get_sys(NULL, "cclk");
 	if (IS_ERR(cpu_clk))
 		return PTR_ERR(cpu_clk);
 
 	pll_x_clk = clk_get_sys(NULL, "pll_x");
-	if (IS_ERR(pll_x_clk))
-		return PTR_ERR(pll_x_clk);
+	if (IS_ERR(pll_x_clk)) {
+		err = PTR_ERR(pll_x_clk);
+		goto put_cpu;
+	}
 
 	pll_p_clk = clk_get_sys(NULL, "pll_p");
-	if (IS_ERR(pll_p_clk))
-		return PTR_ERR(pll_p_clk);
+	if (IS_ERR(pll_p_clk)) {
+		err = PTR_ERR(pll_p_clk);
+		goto put_pll_x;
+	}
+
+	err = cpufreq_register_driver(&tegra_cpufreq_driver);
+	if (err)
+		goto put_pll_p;
+
+	return 0;
+
+put_pll_p:
+	clk_put(pll_p_clk);
+put_pll_x:
+	clk_put(pll_x_clk);
+put_cpu:
+	clk_put(cpu_clk);
 
-	return cpufreq_register_driver(&tegra_cpufreq_driver);
+	return err;
 }
 
 static void __exit tegra_cpufreq_exit(void)
 {
 	cpufreq_unregister_driver(&tegra_cpufreq_driver);
+	clk_put(pll_p_clk);
+	clk_put(pll_x_clk);
 	clk_put(cpu_clk);
 }
 
-- 
2.17.0

  parent reply	other threads:[~2018-05-18 20:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-18 20:06 [PATCH v2 00/11] Clean up Tegra20 cpufreq driver Dmitry Osipenko
2018-05-18 20:06 ` [PATCH v2 01/11] cpufreq: tegra20: Change module description Dmitry Osipenko
2018-05-18 20:06 ` [PATCH v2 02/11] cpufreq: tegra20: Clean up whitespaces in the code Dmitry Osipenko
2018-05-18 20:06 ` [PATCH v2 03/11] cpufreq: tegra20: Clean up included headers Dmitry Osipenko
2018-05-21  5:44   ` Viresh Kumar
2018-05-18 20:06 ` [PATCH v2 04/11] cpufreq: tegra20: Remove EMC clock usage Dmitry Osipenko
2018-05-18 20:06 ` Dmitry Osipenko [this message]
2018-05-18 20:06 ` [PATCH v2 06/11] cpufreq: tegra20: Remove unneeded check in tegra_cpu_init Dmitry Osipenko
2018-05-18 20:06 ` [PATCH v2 07/11] cpufreq: tegra20: Remove unnecessary parentheses Dmitry Osipenko
2018-05-18 22:02   ` Thierry Reding
2018-05-21  5:44   ` Viresh Kumar
2018-05-18 20:06 ` [PATCH v2 08/11] cpufreq: tegra20: Remove unneeded variable initialization Dmitry Osipenko
2018-05-18 20:06 ` [PATCH v2 09/11] cpufreq: tegra20: Check if this is Tegra20 machine Dmitry Osipenko
2018-05-18 20:06 ` [PATCH v2 10/11] cpufreq: tegra20: Allow cpufreq driver to be built as loadable module Dmitry Osipenko
2018-05-18 20:06 ` [PATCH v2 11/11] cpufreq: tegra20: Wrap cpufreq into platform driver Dmitry Osipenko

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=20180518200642.24815-6-digetx@gmail.com \
    --to=digetx@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=pgwipeout@gmail.com \
    --cc=rjw@rjwysocki.net \
    --cc=thierry.reding@gmail.com \
    --cc=viresh.kumar@linaro.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 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.