summaryrefslogtreecommitdiff
path: root/drivers/clk/clk.c
diff options
context:
space:
mode:
authorStanimir Varbanov <svarbanov@mm-sol.com>2015-01-05 19:04:23 +0300
committerMichael Turquette <mturquette@linaro.org>2015-01-17 22:33:57 +0300
commitc7662fc59ca38517e0ec04ceaa123ed8209ab6bf (patch)
tree1558b888ae88613c645fdc15eecbe253492618d3 /drivers/clk/clk.c
parent176a107b868781c8d6868454aea7d07e0b82d6b8 (diff)
downloadlinux-c7662fc59ca38517e0ec04ceaa123ed8209ab6bf.tar.xz
clk: fix possible null pointer dereference
The commit 646cafc6 (clk: Change clk_ops->determine_rate to return a clk_hw as the best parent) opens a possibility for null pointer dereference, fix this. Signed-off-by: Stanimir Varbanov <svarbanov@mm-sol.com> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Michael Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/clk/clk.c')
-rw-r--r--drivers/clk/clk.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index f4963b7d4e17..d48ac71c6c8b 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1366,7 +1366,7 @@ static struct clk *clk_calc_new_rates(struct clk *clk, unsigned long rate)
new_rate = clk->ops->determine_rate(clk->hw, rate,
&best_parent_rate,
&parent_hw);
- parent = parent_hw->clk;
+ parent = parent_hw ? parent_hw->clk : NULL;
} else if (clk->ops->round_rate) {
new_rate = clk->ops->round_rate(clk->hw, rate,
&best_parent_rate);