From patchwork Fri May 18 20:06:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 10412063 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5EDA660230 for ; Fri, 18 May 2018 20:10:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4EEC128AC5 for ; Fri, 18 May 2018 20:10:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4129828ACB; Fri, 18 May 2018 20:10:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2CD728AC5 for ; Fri, 18 May 2018 20:10:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752346AbeERUKG (ORCPT ); Fri, 18 May 2018 16:10:06 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:44783 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752332AbeERUHY (ORCPT ); Fri, 18 May 2018 16:07:24 -0400 Received: by mail-lf0-f67.google.com with SMTP id h197-v6so15646837lfg.11; Fri, 18 May 2018 13:07:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PzvdQWNzLjuQdFPt1cKJzkvIL6qitp4Vvf6JntJtB6o=; b=Kb2Glcq93o32LEZECAczIYjO27JLpUTJWVns7zQo66GzC3wgiob4+lxSb/Ap1UUUE0 +e0PGj++PKxBNfdWV88PKQTrUG8KJE0k6HTZMdceudo/IsmU4ss8M8ak6oUzTDJdYSLM BQypIfZje9K6CKUCTcMXd2hbqjokhBjhgGv6ztgybVby5JSfbzCPhdzuyBTKMniCYsNT 4m/lCWrlvfblg4XXxmOj1b/nhuzoFT9zYn9PuWfXnMbpIGnPZCpsmC+kG01MeSLpdu/P HPj3oMVZqVBNq3s0HKRMsy/nzJSAykhxc7hHDS2bqICOSEyW4DhwfS/M2AlAz4pDZFo3 M2Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PzvdQWNzLjuQdFPt1cKJzkvIL6qitp4Vvf6JntJtB6o=; b=Mae1yN7Vum5GHhZhKi1J9ea08f8mIYf9mslV1i7Timphj5KqNAfz0YQ36CiCzWYe8M G6aZmY4COBaHifUYerVl5Ji65SgA6J7Bo68UPsPw64t2aneby/Dglk87qwujmYoYSw6v YfCoGHW+aOqqz7XbO5TYaohpTpaSRyaPbNq5Ks9xFTQU3lVGdTUQ7q3hGp+rPmYGRxCs d7fbkVo7oCrwtPa/mwQ+JNOFNiFHLdwnWQsIwCw9EV+x2qr82dajNkkPeukvFjvJ7lO9 zeHvhsEII47FEY/fUs920IJFKEOjAInNHgTdX/Y1ToSCAjLo3zSBAGTOOpboXsdh+M8f 8DBA== X-Gm-Message-State: ALKqPwebTngjGpVKMXa0BNBghlUzffgYq1CaGVFFq7pMHSpcW7jcsY/c 5Vs/b62kz8dRtiNZ0zJoeBk= X-Google-Smtp-Source: AB8JxZqNR1Nm7Bmb6y1nH7fx+1/fUa9dCtAXGW00Lsti84XNaJUXQpYVy1Wu9fBELVw0QGlWJjoDuw== X-Received: by 2002:a19:a9d4:: with SMTP id s203-v6mr22881508lfe.37.1526674042011; Fri, 18 May 2018 13:07:22 -0700 (PDT) Received: from localhost.localdomain ([109.252.91.60]) by smtp.gmail.com with ESMTPSA id z132-v6sm2026987lfd.45.2018.05.18.13.07.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 May 2018 13:07:21 -0700 (PDT) From: Dmitry Osipenko To: "Rafael J. Wysocki" , Viresh Kumar , Thierry Reding , Jonathan Hunter Cc: linux-tegra@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Geis Subject: [PATCH v2 05/11] cpufreq: tegra20: Release clocks properly Date: Fri, 18 May 2018 23:06:36 +0300 Message-Id: <20180518200642.24815-6-digetx@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180518200642.24815-1-digetx@gmail.com> References: <20180518200642.24815-1-digetx@gmail.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Properly put requested clocks in the module init/exit code. Signed-off-by: Dmitry Osipenko Acked-by: Viresh Kumar Acked-by: Thierry Reding --- 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); }