[PATCH 3/6] clk: Fix error handling in clk_get_parent()

Samuel Holland samuel at sholland.org
Mon Feb 20 06:59:36 CET 2023


Do not return both NULL and error pointers. The function is only
documented as returning error pointers.

Fixes: 8a1661f20e6c ("drivers: clk: Handle gracefully NULL pointers")
Signed-off-by: Samuel Holland <samuel at sholland.org>
---

 drivers/clk/clk-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index 78299dbceb2..5bce976b060 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -490,7 +490,7 @@ struct clk *clk_get_parent(struct clk *clk)
 
 	debug("%s(clk=%p)\n", __func__, clk);
 	if (!clk_valid(clk))
-		return NULL;
+		return ERR_PTR(-ENODEV);
 
 	pdev = dev_get_parent(clk->dev);
 	if (!pdev)
-- 
2.39.2



More information about the U-Boot mailing list