Re: [PATCH] soc: fsl: cpm1: tsa: Fix clock leak in tsa_of_parse_tdms()
From: Herve Codina
Date: Thu Sep 17 2026 - 17:42:47 EST
Hi Wentao,
On Thu, 17 Sep 2026 15:27:19 +0000
Wentao Liang <vulab@xxxxxxxxxxx> 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@xxxxxxxxxxxxxxx
> Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
> ---
> 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@xxxxxxxxxxx>
Best regards,
Hervé