From 9345c99eb5e4dcb1b16161aa7f1876865e25006e Mon Sep 17 00:00:00 2001 From: "Ye.Li" Date: Fri, 4 Dec 2015 15:17:07 +0800 Subject: MLK-11952 Video: IPU: Fix dereferencing NULL pointer problem By Coverity check, the clk_set_rate function dereferences the clk pointer without checking whether it is NULL. This may cause problem when clk is NULL. Fix the problem by adding NULL check. Signed-off-by: Ye.Li (cherry picked from commit ded2f2958d568411274eeecd265fcc1181638335) (cherry picked from commit b58ac1502391d87470918ff8d172b2b8dc1e7a68) --- drivers/video/ipu_common.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers') diff --git a/drivers/video/ipu_common.c b/drivers/video/ipu_common.c index ebe720a..28b4bcf 100644 --- a/drivers/video/ipu_common.c +++ b/drivers/video/ipu_common.c @@ -128,6 +128,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; } -- cgit v1.1