Thread (91 messages) 91 messages, 3 authors, 2023-02-09

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

From: Chen-Yu Tsai <wenst@chromium.org>
Date: 2023-02-07 06:17:03
Also in: linux-clk, linux-mediatek, lkml

On Mon, Feb 6, 2023 at 11:29 PM AngeloGioacchino Del Regno
[off-list ref] 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@chromium.org>
quoted hunk ↗ jump to hunk
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help