[PATCH v2 29/31] clk: mediatek: mt8195: Implement error handling in probe functions

AngeloGioacchino Del Regno angelogioacchino.delregno at collabora.com
Thu Feb 3 01:47:21 PST 2022


Il 02/02/22 14:48, Chen-Yu Tsai ha scritto:
> Until now the mediatek clk driver library did not have any way to
> unregister clks, and so all drivers did not do proper cleanup in
> their error paths.
> 
> Now that the library does have APIs to unregister clks, use them
> in the error path of the probe functions for the mt8195 clk drivers
> to do proper cleanup.
> 
> Signed-off-by: Chen-Yu Tsai <wenst at chromium.org>
> Reviewed-by: Miles Chen <miles.chen at mediatek.com>
> ---
>   drivers/clk/mediatek/clk-mt8195-apmixedsys.c | 13 ++++--
>   drivers/clk/mediatek/clk-mt8195-apusys_pll.c | 11 ++++-
>   drivers/clk/mediatek/clk-mt8195-topckgen.c   | 49 +++++++++++++++-----
>   drivers/clk/mediatek/clk-mt8195-vdo0.c       |  4 +-
>   drivers/clk/mediatek/clk-mt8195-vdo1.c       |  4 +-
>   5 files changed, 63 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/clk/mediatek/clk-mt8195-apmixedsys.c b/drivers/clk/mediatek/clk-mt8195-apmixedsys.c
> index 5b1b7dc447eb..af8d80f25f30 100644
> --- a/drivers/clk/mediatek/clk-mt8195-apmixedsys.c
> +++ b/drivers/clk/mediatek/clk-mt8195-apmixedsys.c
> @@ -120,17 +120,24 @@ static int clk_mt8195_apmixed_probe(struct platform_device *pdev)
>   	if (!clk_data)
>   		return -ENOMEM;
>   
> -	mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
> -	r = mtk_clk_register_gates(node, apmixed_clks, ARRAY_SIZE(apmixed_clks), clk_data);
> +	r = mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
>   	if (r)
>   		goto free_apmixed_data;
>   
> +	r = mtk_clk_register_gates(node, apmixed_clks, ARRAY_SIZE(apmixed_clks), clk_data);
> +	if (r)
> +		goto unregister_plls;
> +
>   	r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
>   	if (r)
> -		goto free_apmixed_data;
> +		goto unregister_gates;
>   
>   	return r;
>   
> +unregister_gates:
> +	mtk_clk_register_gates(node, apmixed_clks, ARRAY_SIZE(apmixed_clks), clk_data);
> +unregister_plls:
> +	mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);

You mean mtk_clk_*un*register_{gates,plls} here... please fix!






More information about the linux-arm-kernel mailing list