From: Michael Walle <michael@walle.cc>
To: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Stephen Boyd <sboyd@kernel.org>,
Michael Turquette <mturquette@baylibre.com>,
Michael Walle <michael@walle.cc>
Subject: [PATCH v2 1/3] clk: fsl-sai: fix memory leak
Date: Thu, 5 Nov 2020 20:27:44 +0100 [thread overview]
Message-ID: <20201105192746.19564-2-michael@walle.cc> (raw)
In-Reply-To: <20201105192746.19564-1-michael@walle.cc>
If the device is removed we don't unregister the composite clock. Fix
that.
Fixes: 9cd10205227c ("clk: fsl-sai: new driver")
Signed-off-by: Michael Walle <michael@walle.cc>
---
Changes since v1:
- none
drivers/clk/clk-fsl-sai.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/clk/clk-fsl-sai.c b/drivers/clk/clk-fsl-sai.c
index 0221180a4dd7..1e81c8d8a6fd 100644
--- a/drivers/clk/clk-fsl-sai.c
+++ b/drivers/clk/clk-fsl-sai.c
@@ -68,9 +68,20 @@ static int fsl_sai_clk_probe(struct platform_device *pdev)
if (IS_ERR(hw))
return PTR_ERR(hw);
+ platform_set_drvdata(pdev, hw);
+
return devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, hw);
}
+static int fsl_sai_clk_remove(struct platform_device *pdev)
+{
+ struct clk_hw *hw = platform_get_drvdata(pdev);
+
+ clk_hw_unregister_composite(hw);
+
+ return 0;
+}
+
static const struct of_device_id of_fsl_sai_clk_ids[] = {
{ .compatible = "fsl,vf610-sai-clock" },
{ }
@@ -79,6 +90,7 @@ MODULE_DEVICE_TABLE(of, of_fsl_sai_clk_ids);
static struct platform_driver fsl_sai_clk_driver = {
.probe = fsl_sai_clk_probe,
+ .remove = fsl_sai_clk_remove,
.driver = {
.name = "fsl-sai-clk",
.of_match_table = of_fsl_sai_clk_ids,
--
2.20.1
next prev parent reply other threads:[~2020-11-05 19:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-05 19:27 [PATCH v2 0/3] clk: fsl-sai: fix memory leak Michael Walle
2020-11-05 19:27 ` Michael Walle [this message]
2020-12-07 22:13 ` [PATCH v2 1/3] " Stephen Boyd
2020-11-05 19:27 ` [PATCH v2 2/3] clk: composite: add devm_clk_hw_register_composite_pdata() Michael Walle
2020-12-07 22:13 ` Stephen Boyd
2020-11-05 19:27 ` [PATCH v2 3/3] clk: fsl-sai: use devm_clk_hw_register_composite_pdata() Michael Walle
2020-12-07 22:13 ` Stephen Boyd
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=20201105192746.19564-2-michael@walle.cc \
--to=michael@walle.cc \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.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;
as well as URLs for NNTP newsgroup(s).