[PATCH v1 07/45] clk: mediatek: mt2712: Add error handling to clk_mt2712_apmixed_probe()

Chen-Yu Tsai wenst at chromium.org
Mon Feb 6 22:16:46 PST 2023


On Mon, Feb 6, 2023 at 11:29 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno at collabora.com> wrote:
>
> This function was completely missing error handling: add it.
>

Fixes tag?

Code looks OK. So once the tag is added,

Reviewed-by: Chen-Yu Tsai <wenst at chromium.org>

> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno at collabora.com>
> ---
>  drivers/clk/mediatek/clk-mt2712.c | 18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/clk/mediatek/clk-mt2712.c b/drivers/clk/mediatek/clk-mt2712.c
> index ce28ee47f5cf..8aa361f0fa13 100644
> --- a/drivers/clk/mediatek/clk-mt2712.c
> +++ b/drivers/clk/mediatek/clk-mt2712.c
> @@ -1091,15 +1091,25 @@ static int clk_mt2712_apmixed_probe(struct platform_device *pdev)
>         struct device_node *node = pdev->dev.of_node;
>
>         clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK);
> +       if (!clk_data)
> +               return -ENOMEM;
>
> -       mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
> +       r = mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
> +       if (r)
> +               goto free_clk_data;
>
>         r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
> +       if (r) {
> +               dev_err(&pdev->dev, "Cannot register clock provider: %d\n", r);
> +               goto unregister_plls;
> +       }
>
> -       if (r != 0)
> -               pr_err("%s(): could not register clock provider: %d\n",
> -                       __func__, r);
> +       return 0;
>
> +unregister_plls:
> +       mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data);
> +free_clk_data:
> +       mtk_free_clk_data(clk_data);
>         return r;
>  }
>
> --
> 2.39.1
>



More information about the linux-arm-kernel mailing list