[U-Boot] [PATCH 1/2] video: ipu: Fix dereferencing NULL pointer problem

Peng Fan peng.fan at nxp.com
Tue Jan 2 07:25:36 UTC 2018


The clk_set_rate function dereferences the clk pointer without
checking whether it is NULL. This may cause problem when clk is NULL.

Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
 drivers/video/ipu_common.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/video/ipu_common.c b/drivers/video/ipu_common.c
index 96229da502..b3b09e6982 100644
--- a/drivers/video/ipu_common.c
+++ b/drivers/video/ipu_common.c
@@ -134,6 +134,10 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
 {
 	if (clk && clk->set_rate)
 		clk->set_rate(clk, rate);
+
+	if (!clk)
+		return 0;
+
 	return clk->rate;
 }
 
-- 
2.14.1



More information about the U-Boot mailing list