]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
video: ipu: Fix dereferencing NULL pointer problem
authorPeng Fan <peng.fan@nxp.com>
Tue, 2 Jan 2018 07:25:36 +0000 (15:25 +0800)
committerAnatolij Gustschin <agust@denx.de>
Wed, 3 Jan 2018 08:46:52 +0000 (09:46 +0100)
The clk_set_rate function dereferences the clk pointer without
checking whether it is NULL. This may cause problem when clk is NULL.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
drivers/video/ipu_common.c

index 96229da502bc13998721ccef733e4d93021b8302..889085aa767e2fee4ac7b483d6f9b7cfc0b20423 100644 (file)
@@ -132,8 +132,12 @@ struct clk *clk_get_parent(struct clk *clk)
 
 int clk_set_rate(struct clk *clk, unsigned long rate)
 {
-       if (clk && clk->set_rate)
+       if (!clk)
+               return 0;
+
+       if (clk->set_rate)
                clk->set_rate(clk, rate);
+
        return clk->rate;
 }