* [PATCH 2/2] clk: imx: clk-imx8mp: add error handling of of_clk_add_hw_provider
@ 2023-04-24 9:24 Yuxing Liu
2023-04-28 7:55 ` Peng Fan
0 siblings, 1 reply; 2+ messages in thread
From: Yuxing Liu @ 2023-04-24 9:24 UTC (permalink / raw)
To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
NXP Linux Team
Cc: hust-os-kernel-patches, Yuxing Liu, Dongliang Mu, linux-clk,
linux-arm-kernel, linux-kernel
Referring to clk-imx8mq.c, check the return code of of_clk_add_hw_provider,
if it returns negtive, print error info and unregister hws,
which makes the program more robust.
Signed-off-by: Yuxing Liu <lyx2022@hust.edu.cn>
Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
---
This patch is untested on real device.
---
drivers/clk/imx/clk-imx8mp.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/imx/clk-imx8mp.c b/drivers/clk/imx/clk-imx8mp.c
index 353d58b665f9..de7d2d2176be 100644
--- a/drivers/clk/imx/clk-imx8mp.c
+++ b/drivers/clk/imx/clk-imx8mp.c
@@ -414,6 +414,7 @@ static int imx8mp_clocks_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct device_node *np;
void __iomem *anatop_base, *ccm_base;
+ int err;
np = of_find_compatible_node(NULL, NULL, "fsl,imx8mp-anatop");
anatop_base = devm_of_iomap(dev, np, 0, NULL);
@@ -717,7 +718,12 @@ static int imx8mp_clocks_probe(struct platform_device *pdev)
imx_check_clk_hws(hws, IMX8MP_CLK_END);
- of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data);
+ err = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data);
+ if (err < 0) {
+ dev_err(dev, "failed to register hws for i.MX8MP\n");
+ imx_unregister_hw_clocks(hws, IMX8MP_CLK_END);
+ return err;
+ }
imx_register_uart_clocks();
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 2/2] clk: imx: clk-imx8mp: add error handling of of_clk_add_hw_provider
2023-04-24 9:24 [PATCH 2/2] clk: imx: clk-imx8mp: add error handling of of_clk_add_hw_provider Yuxing Liu
@ 2023-04-28 7:55 ` Peng Fan
0 siblings, 0 replies; 2+ messages in thread
From: Peng Fan @ 2023-04-28 7:55 UTC (permalink / raw)
To: Yuxing Liu, Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
NXP Linux Team
Cc: hust-os-kernel-patches, Dongliang Mu, linux-clk,
linux-arm-kernel, linux-kernel
On 4/24/2023 5:24 PM, Yuxing Liu wrote:
> Referring to clk-imx8mq.c, check the return code of of_clk_add_hw_provider,
> if it returns negtive, print error info and unregister hws,
> which makes the program more robust.
Patch 1 & 2 merged into 1 patch, no need seperate.
Regards,
Peng.
>
> Signed-off-by: Yuxing Liu <lyx2022@hust.edu.cn>
> Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
> ---
> This patch is untested on real device.
> ---
> drivers/clk/imx/clk-imx8mp.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/imx/clk-imx8mp.c b/drivers/clk/imx/clk-imx8mp.c
> index 353d58b665f9..de7d2d2176be 100644
> --- a/drivers/clk/imx/clk-imx8mp.c
> +++ b/drivers/clk/imx/clk-imx8mp.c
> @@ -414,6 +414,7 @@ static int imx8mp_clocks_probe(struct platform_device *pdev)
> struct device *dev = &pdev->dev;
> struct device_node *np;
> void __iomem *anatop_base, *ccm_base;
> + int err;
>
> np = of_find_compatible_node(NULL, NULL, "fsl,imx8mp-anatop");
> anatop_base = devm_of_iomap(dev, np, 0, NULL);
> @@ -717,7 +718,12 @@ static int imx8mp_clocks_probe(struct platform_device *pdev)
>
> imx_check_clk_hws(hws, IMX8MP_CLK_END);
>
> - of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data);
> + err = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data);
> + if (err < 0) {
> + dev_err(dev, "failed to register hws for i.MX8MP\n");
> + imx_unregister_hw_clocks(hws, IMX8MP_CLK_END);
> + return err;
> + }
>
> imx_register_uart_clocks();
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-04-28 7:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-24 9:24 [PATCH 2/2] clk: imx: clk-imx8mp: add error handling of of_clk_add_hw_provider Yuxing Liu
2023-04-28 7:55 ` Peng Fan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®