* [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
2026-09-18 8:39 ` Christophe Leroy (CS GROUP)
0 siblings, 2 replies; 4+ 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 related [flat|nested] 4+ 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
2026-09-18 8:39 ` Christophe Leroy (CS GROUP)
1 sibling, 0 replies; 4+ 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] 4+ 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
@ 2026-09-18 8:39 ` Christophe Leroy (CS GROUP)
2026-10-09 9:21 ` Christophe Leroy (CS GROUP)
1 sibling, 1 reply; 4+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2026-09-18 8:39 UTC (permalink / raw)
To: broonie, Wentao Liang
Cc: Christophe Leroy, herve.codina, leoyang.li, linux-arm-kernel,
linux-kernel, linuxppc-dev, qiang.zhao, stable
On Thu, 17 Sep 2026 15:27:19 +0000, Wentao Liang 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.
>
> [...]
Applied, thanks!
[1/1] soc: fsl: cpm1: tsa: Fix clock leak in tsa_of_parse_tdms()
commit: 7b3b0598c00e67f2df85d0b4cd99eaa3be6c9bfd
Best regards,
--
Christophe Leroy (CS GROUP) <chleroy@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] soc: fsl: cpm1: tsa: Fix clock leak in tsa_of_parse_tdms()
2026-09-18 8:39 ` Christophe Leroy (CS GROUP)
@ 2026-10-09 9:21 ` Christophe Leroy (CS GROUP)
0 siblings, 0 replies; 4+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2026-10-09 9:21 UTC (permalink / raw)
To: broonie, Wentao Liang
Cc: herve.codina, leoyang.li, linux-arm-kernel, linux-kernel,
linuxppc-dev, qiang.zhao, stable
Le 18/09/2026 à 10:39, Christophe Leroy (CS GROUP) a écrit :
>
> On Thu, 17 Sep 2026 15:27:19 +0000, Wentao Liang 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.
>>
>> [...]
>
> Applied, thanks!
>
> [1/1] soc: fsl: cpm1: tsa: Fix clock leak in tsa_of_parse_tdms()
> commit: 7b3b0598c00e67f2df85d0b4cd99eaa3be6c9bfd
>
> Best regards,
For your information, I folded in this patch a similar fix to
tsa_remove() function.
Christophe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-09 9:21 UTC | newest]
Thread overview: 4+ 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
2026-09-18 8:39 ` Christophe Leroy (CS GROUP)
2026-10-09 9:21 ` Christophe Leroy (CS GROUP)
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.