Re: [PATCH net] net: pcs: xpcs: fix clock reference leak on xpcs_init_clks failure
From: Simon Horman
Date: Mon Sep 21 2026 - 11:15:33 EST
On Sun, Sep 20, 2026 at 01:20:21AM +0800, Coia Prant wrote:
> xpcs_init_clks() takes references with clk_bulk_get_optional() and then
> enables them with clk_bulk_prepare_enable(). If the enable step fails,
> the function returns without dropping the references.
>
> xpcs_create() handles the failure through out_free_data, which calls
> xpcs_free_data() but never xpcs_clear_clks(), so the clk references are
> leaked.
>
> Add the missing clk_bulk_put() on the enable failure path. The
> prepare/enable side is already rolled back by
> clk_bulk_prepare_enable() itself.
>
> Fixes: f6bb3e9d98c2 ("net: pcs: xpcs: Add Synopsys DW xPCS platform device driver")
> Signed-off-by: Coia Prant <coiaprant@xxxxxxxxx>
Reviewed-by: Simon Horman <horms@xxxxxxxxxx>