[PATCH 2/4] pmdomain: rockchip: fix clock leak on domain probe failure

Sebastian Reichel sebastian.reichel at collabora.com
Fri Sep 18 10:21:44 PDT 2026


Hi,

On Fri, Sep 18, 2026 at 08:07:36PM +0800, Shawn Lin wrote:
> When of_clk_get() failed in the middle of the loop, the references of
> the clocks acquired so far were leaked instead of being released by
> the error path.
> 
> Fixes: d909072d0521 ("soc: rockchip: power-domain: use clk_bulk APIs")
> Signed-off-by: Shawn Lin <shawn.lin at rock-chips.com>
> ---

Right, but this should switch

pd->clks = devm_kcalloc(...);

to

pd->clks = devm_kzalloc(...);

at the same time to ensure that clk_bulk_put() does not run over
non-initialized data. Otherwise

Reviewed-by: Sebastian Reichel <sebastian.reichel at collabora.com>

Greetings,

-- Sebastian

> 
>  drivers/pmdomain/rockchip/pm-domains.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c
> index 068dd4b3..b6b099b 100644
> --- a/drivers/pmdomain/rockchip/pm-domains.c
> +++ b/drivers/pmdomain/rockchip/pm-domains.c
> @@ -842,7 +842,7 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
>  			dev_err(pmu->dev,
>  				"%pOFn: failed to get clk at index %d: %d\n",
>  				node, i, error);
> -			return error;
> +			goto err_put_clocks;
>  		}
>  	}
>  
> -- 
> 2.7.4
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-rockchip/attachments/20260918/bf9259af/attachment.sig>


More information about the Linux-rockchip mailing list