summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorYe.Li <B37916@freescale.com>2015-12-04 15:17:07 +0800
committerYe Li <ye.li@nxp.com>2016-03-25 11:53:30 +0800
commitb58ac1502391d87470918ff8d172b2b8dc1e7a68 (patch)
tree73107ad126e50bffdf005003b67b8c7812cc52f5 /drivers
parentb484d36882c8db9ddb8262001cfef187a28051b2 (diff)
downloadu-boot-imx-b58ac1502391d87470918ff8d172b2b8dc1e7a68.zip
u-boot-imx-b58ac1502391d87470918ff8d172b2b8dc1e7a68.tar.gz
u-boot-imx-b58ac1502391d87470918ff8d172b2b8dc1e7a68.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> (cherry picked from commit ded2f2958d568411274eeecd265fcc1181638335)
Diffstat (limited to 'drivers')
-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 ac91d9f..771cb84 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;
}