From e8760d8a698c3d61d6267f32acc2b845ac1de15e Mon Sep 17 00:00:00 2001 From: Anson Huang Date: Tue, 6 Aug 2019 14:46:14 +0800 Subject: [PATCH] clk: imx8mq: Unregister clks when of_clk_add_provider failed When of_clk_add_provider failed, all clks should be unregistered. Signed-off-by: Anson Huang Reviewed-by: Daniel Baluta Signed-off-by: Shawn Guo --- drivers/clk/imx/clk-imx8mq.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/clk/imx/clk-imx8mq.c b/drivers/clk/imx/clk-imx8mq.c index 04302f27dd0f..81a024928408 100644 --- a/drivers/clk/imx/clk-imx8mq.c +++ b/drivers/clk/imx/clk-imx8mq.c @@ -562,10 +562,18 @@ static int imx8mq_clocks_probe(struct platform_device *pdev) clk_data.clk_num = ARRAY_SIZE(clks); err = of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); - WARN_ON(err); + if (err < 0) { + dev_err(dev, "failed to register clks for i.MX8MQ\n"); + goto unregister_clks; + } imx_register_uart_clocks(uart_clks); + return 0; + +unregister_clks: + imx_unregister_clocks(clks, ARRAY_SIZE(clks)); + return err; } -- 2.30.2