diff options
author | Ye.Li <B37916@freescale.com> | 2015-12-04 15:17:07 +0800 |
---|---|---|
committer | Ye.Li <B37916@freescale.com> | 2015-12-04 15:17:07 +0800 |
commit | ded2f2958d568411274eeecd265fcc1181638335 (patch) | |
tree | 580ee7a1458fd389228019033760c306aa253c7f | |
parent | 3de039f82371e8ba65e28fda43621f5a70766f55 (diff) | |
download | u-boot-imx-ded2f2958d568411274eeecd265fcc1181638335.zip u-boot-imx-ded2f2958d568411274eeecd265fcc1181638335.tar.gz u-boot-imx-ded2f2958d568411274eeecd265fcc1181638335.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.c | 4 |
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; } |