[PATCH 02/22] clk: check pointer returned by dev_get_parent()

Claudiu Beznea claudiu.beznea at microchip.com
Wed Jul 29 16:51:21 CEST 2020


Check pointer returned by dev_get_parent().

Signed-off-by: Claudiu Beznea <claudiu.beznea at microchip.com>
---
 drivers/clk/clk-uclass.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index 70df9d410f4c..aa1f11a27c41 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -459,6 +459,9 @@ struct clk *clk_get_parent(struct clk *clk)
 		return NULL;
 
 	pdev = dev_get_parent(clk->dev);
+	if (!pdev)
+		return ERR_PTR(-ENOMEM);
+
 	pclk = dev_get_clk_ptr(pdev);
 	if (!pclk)
 		return ERR_PTR(-ENODEV);
-- 
2.7.4



More information about the U-Boot mailing list