From: Peng Fan Date: Tue, 2 Jan 2018 07:25:36 +0000 (+0800) Subject: video: ipu: Fix dereferencing NULL pointer problem X-Git-Tag: v2025.01-rc5-pxa1908~5208 X-Git-Url: http://git.dujemihanovic.xyz/%22http:/www.sics.se/static/git-logo.png?a=commitdiff_plain;h=cca3ff054ab3e1f5f0d3f2d58da263cae201db50;p=u-boot.git 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 Signed-off-by: Anatolij Gustschin --- 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; }