summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYe.Li <B37916@freescale.com>2015-12-04 15:17:07 +0800
committerguoyin.chen <guoyin.chen@freescale.com>2016-03-04 15:35:50 +0800
commit541b2a66174c2f6aafb33c61f56f6dadded02d71 (patch)
treebdae67b013988c6a626d2cca8fa13ee72e1b5c42
parent7e7cbcb80a20da1e744091a69e52db1b935750a2 (diff)
downloadu-boot-imx-541b2a66174c2f6aafb33c61f56f6dadded02d71.zip
u-boot-imx-541b2a66174c2f6aafb33c61f56f6dadded02d71.tar.gz
u-boot-imx-541b2a66174c2f6aafb33c61f56f6dadded02d71.tar.bz2
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 <B37916@freescale.com>
-rw-r--r--drivers/video/ipu_common.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/video/ipu_common.c b/drivers/video/ipu_common.c
index 0efb3db..83ac846 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;
}