[PATCHv4 07/26] clk: do not attempt to fetch clock pointer with null device

Tero Kristo kristo at kernel.org
Tue May 11 10:30:45 CEST 2021


From: Tero Kristo <t-kristo at ti.com>

Bail out early if device returned for the parent clock is null.
This avoids warning prints like this when doing clk dump:

  dev_get_uclass_priv: null device

Signed-off-by: Tero Kristo <t-kristo at ti.com>
Signed-off-by: Tero Kristo <kristo at kernel.org>
---
 drivers/clk/clk-uclass.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index 4ab3c402ed..ac2b7ae84e 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -499,6 +499,8 @@ struct clk *clk_get_parent(struct clk *clk)
 		return NULL;
 
 	pdev = dev_get_parent(clk->dev);
+	if (!pdev)
+		return ERR_PTR(-ENODEV);
 	pclk = dev_get_clk_ptr(pdev);
 	if (!pclk)
 		return ERR_PTR(-ENODEV);
-- 
2.17.1



More information about the U-Boot mailing list