diff options
author | Peng Fan <peng.fan@nxp.com> | 2018-01-02 15:25:36 +0800 |
---|---|---|
committer | Anatolij Gustschin <agust@denx.de> | 2018-01-03 09:46:52 +0100 |
commit | cca3ff054ab3e1f5f0d3f2d58da263cae201db50 (patch) | |
tree | 463dba72c323aed737afe74110cdb8618cc33d65 | |
parent | 1314bd1192b4c67d28bdae7eee639588e88090cd (diff) |
video: ipu: Fix dereferencing NULL pointer problem
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>
-rw-r--r-- | drivers/video/ipu_common.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/video/ipu_common.c b/drivers/video/ipu_common.c index 96229da502..889085aa76 100644 --- a/drivers/video/ipu_common.c +++ b/drivers/video/ipu_common.c @@ -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; } |