* [PATCH] clk: tegra: tegra124-emc: fix device leak on set_rate()
@ 2025-11-21 16:40 Johan Hovold
2026-01-14 10:59 ` Johan Hovold
2026-01-23 1:41 ` Stephen Boyd
0 siblings, 2 replies; 3+ messages in thread
From: Johan Hovold @ 2025-11-21 16:40 UTC (permalink / raw)
To: Peter De Schrijver, Prashant Gaikwad, Michael Turquette,
Stephen Boyd
Cc: Thierry Reding, Mikko Perttunen, Miaoqian Lin, linux-clk,
linux-tegra, linux-kernel, Johan Hovold, stable
Make sure to drop the reference taken when looking up the EMC device and
its driver data on first set_rate().
Note that holding a reference to a device does not prevent its driver
data from going away so there is no point in keeping the reference.
Fixes: 2db04f16b589 ("clk: tegra: Add EMC clock driver")
Fixes: 6d6ef58c2470 ("clk: tegra: tegra124-emc: Fix missing put_device() call in emc_ensure_emc_driver")
Cc: stable@vger.kernel.org # 4.2: 6d6ef58c2470
Cc: Mikko Perttunen <mperttunen@nvidia.com>
Cc: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/clk/tegra/clk-tegra124-emc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/tegra/clk-tegra124-emc.c b/drivers/clk/tegra/clk-tegra124-emc.c
index 2a6db0434281..2777e70da8b9 100644
--- a/drivers/clk/tegra/clk-tegra124-emc.c
+++ b/drivers/clk/tegra/clk-tegra124-emc.c
@@ -197,8 +197,8 @@ static struct tegra_emc *emc_ensure_emc_driver(struct tegra_clk_emc *tegra)
tegra->emc_node = NULL;
tegra->emc = platform_get_drvdata(pdev);
+ put_device(&pdev->dev);
if (!tegra->emc) {
- put_device(&pdev->dev);
pr_err("%s: cannot find EMC driver\n", __func__);
return NULL;
}
--
2.51.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: tegra: tegra124-emc: fix device leak on set_rate()
2025-11-21 16:40 [PATCH] clk: tegra: tegra124-emc: fix device leak on set_rate() Johan Hovold
@ 2026-01-14 10:59 ` Johan Hovold
2026-01-23 1:41 ` Stephen Boyd
1 sibling, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2026-01-14 10:59 UTC (permalink / raw)
To: Peter De Schrijver, Prashant Gaikwad, Michael Turquette,
Stephen Boyd
Cc: Thierry Reding, Mikko Perttunen, Miaoqian Lin, linux-clk,
linux-tegra, linux-kernel, stable
On Fri, Nov 21, 2025 at 05:40:03PM +0100, Johan Hovold wrote:
> Make sure to drop the reference taken when looking up the EMC device and
> its driver data on first set_rate().
>
> Note that holding a reference to a device does not prevent its driver
> data from going away so there is no point in keeping the reference.
>
> Fixes: 2db04f16b589 ("clk: tegra: Add EMC clock driver")
> Fixes: 6d6ef58c2470 ("clk: tegra: tegra124-emc: Fix missing put_device() call in emc_ensure_emc_driver")
> Cc: stable@vger.kernel.org # 4.2: 6d6ef58c2470
> Cc: Mikko Perttunen <mperttunen@nvidia.com>
> Cc: Miaoqian Lin <linmq006@gmail.com>
> Signed-off-by: Johan Hovold <johan@kernel.org>
Can this one be picked up for 6.19 (or 6.20) now?
Johan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: tegra: tegra124-emc: fix device leak on set_rate()
2025-11-21 16:40 [PATCH] clk: tegra: tegra124-emc: fix device leak on set_rate() Johan Hovold
2026-01-14 10:59 ` Johan Hovold
@ 2026-01-23 1:41 ` Stephen Boyd
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2026-01-23 1:41 UTC (permalink / raw)
To: Johan Hovold, Michael Turquette, Peter De Schrijver,
Prashant Gaikwad
Cc: Thierry Reding, Mikko Perttunen, Miaoqian Lin, linux-clk,
linux-tegra, linux-kernel, Johan Hovold, stable
Quoting Johan Hovold (2025-11-21 09:40:03)
> Make sure to drop the reference taken when looking up the EMC device and
> its driver data on first set_rate().
>
> Note that holding a reference to a device does not prevent its driver
> data from going away so there is no point in keeping the reference.
>
> Fixes: 2db04f16b589 ("clk: tegra: Add EMC clock driver")
> Fixes: 6d6ef58c2470 ("clk: tegra: tegra124-emc: Fix missing put_device() call in emc_ensure_emc_driver")
> Cc: stable@vger.kernel.org # 4.2: 6d6ef58c2470
> Cc: Mikko Perttunen <mperttunen@nvidia.com>
> Cc: Miaoqian Lin <linmq006@gmail.com>
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
Applied to clk-next
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-01-23 1:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-21 16:40 [PATCH] clk: tegra: tegra124-emc: fix device leak on set_rate() Johan Hovold
2026-01-14 10:59 ` Johan Hovold
2026-01-23 1:41 ` Stephen Boyd
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox