summaryrefslogtreecommitdiff
path: root/drivers/video/ipu_common.c
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:53:34 +0800
commit951bc905ee9de3dcc7a1a20922b107636a36d4ca (patch)
treebdae67b013988c6a626d2cca8fa13ee72e1b5c42 /drivers/video/ipu_common.c
parentb77819730f3d75c50896c6f3de8535ab8ed19c51 (diff)
downloadu-boot-imx-951bc905ee9de3dcc7a1a20922b107636a36d4ca.zip
u-boot-imx-951bc905ee9de3dcc7a1a20922b107636a36d4ca.tar.gz
u-boot-imx-951bc905ee9de3dcc7a1a20922b107636a36d4ca.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>
Diffstat (limited to 'drivers/video/ipu_common.c')
-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;
}