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....@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

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to