* [PATCH] soc: fsl: cpm1: tsa: Fix clock leak in tsa_of_parse_tdms()
@ 2026-09-17 15:27 Wentao Liang
2026-09-17 17:49 ` Herve Codina
0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2026-09-17 15:27 UTC (permalink / raw)
To: broonie
Cc: chleroy, herve.codina, leoyang.li, linux-arm-kernel,
linux-kernel, linuxppc-dev, qiang.zhao, Wentao Liang, stable
The error cleanup loop puts l1rsync_clk and l1rclk_clk a second time
and never puts l1tsync_clk or l1tclk_clk, because the branches that
guard the transmit clocks use the receive clock field names.
Use the matching field in each branch so every clock acquired by
tsa_of_parse_tdms() is released exactly once.
Fixes: 1d4ba0b81c1c ("soc: fsl: cpm1: Add support for TSA")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/soc/fsl/qe/tsa.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/soc/fsl/qe/tsa.c b/drivers/soc/fsl/qe/tsa.c
index 4a88e54d25b9..94691369353e 100644
--- a/drivers/soc/fsl/qe/tsa.c
+++ b/drivers/soc/fsl/qe/tsa.c
@@ -865,12 +865,12 @@ static int tsa_of_parse_tdms(struct tsa *tsa, struct device_node *np)
clk_put(tsa->tdm[i].l1rclk_clk);
}
if (tsa->tdm[i].l1tsync_clk) {
- clk_disable_unprepare(tsa->tdm[i].l1rsync_clk);
- clk_put(tsa->tdm[i].l1rsync_clk);
+ clk_disable_unprepare(tsa->tdm[i].l1tsync_clk);
+ clk_put(tsa->tdm[i].l1tsync_clk);
}
if (tsa->tdm[i].l1tclk_clk) {
- clk_disable_unprepare(tsa->tdm[i].l1rclk_clk);
- clk_put(tsa->tdm[i].l1rclk_clk);
+ clk_disable_unprepare(tsa->tdm[i].l1tclk_clk);
+ clk_put(tsa->tdm[i].l1tclk_clk);
}
}
return ret;
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] soc: fsl: cpm1: tsa: Fix clock leak in tsa_of_parse_tdms()
2026-09-17 15:27 [PATCH] soc: fsl: cpm1: tsa: Fix clock leak in tsa_of_parse_tdms() Wentao Liang
@ 2026-09-17 17:49 ` Herve Codina
0 siblings, 0 replies; 2+ messages in thread
From: Herve Codina @ 2026-09-17 17:49 UTC (permalink / raw)
To: Wentao Liang
Cc: broonie, chleroy, leoyang.li, linux-arm-kernel, linux-kernel,
linuxppc-dev, qiang.zhao, stable
Hi Wentao,
On Thu, 17 Sep 2026 15:27:19 +0000
Wentao Liang <vulab@iscas.ac.cn> wrote:
> The error cleanup loop puts l1rsync_clk and l1rclk_clk a second time
> and never puts l1tsync_clk or l1tclk_clk, because the branches that
> guard the transmit clocks use the receive clock field names.
>
> Use the matching field in each branch so every clock acquired by
> tsa_of_parse_tdms() is released exactly once.
>
> Fixes: 1d4ba0b81c1c ("soc: fsl: cpm1: Add support for TSA")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> drivers/soc/fsl/qe/tsa.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/soc/fsl/qe/tsa.c b/drivers/soc/fsl/qe/tsa.c
> index 4a88e54d25b9..94691369353e 100644
> --- a/drivers/soc/fsl/qe/tsa.c
> +++ b/drivers/soc/fsl/qe/tsa.c
> @@ -865,12 +865,12 @@ static int tsa_of_parse_tdms(struct tsa *tsa, struct device_node *np)
> clk_put(tsa->tdm[i].l1rclk_clk);
> }
> if (tsa->tdm[i].l1tsync_clk) {
> - clk_disable_unprepare(tsa->tdm[i].l1rsync_clk);
> - clk_put(tsa->tdm[i].l1rsync_clk);
> + clk_disable_unprepare(tsa->tdm[i].l1tsync_clk);
> + clk_put(tsa->tdm[i].l1tsync_clk);
> }
> if (tsa->tdm[i].l1tclk_clk) {
> - clk_disable_unprepare(tsa->tdm[i].l1rclk_clk);
> - clk_put(tsa->tdm[i].l1rclk_clk);
> + clk_disable_unprepare(tsa->tdm[i].l1tclk_clk);
> + clk_put(tsa->tdm[i].l1tclk_clk);
> }
> }
> return ret;
Indeed, good catch!
Reviewed-by: Herve Codina <herve.codina@bootlin.com>
Best regards,
Hervé
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-17 17:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-17 15:27 [PATCH] soc: fsl: cpm1: tsa: Fix clock leak in tsa_of_parse_tdms() Wentao Liang
2026-09-17 17:49 ` Herve Codina
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®