summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanimir Varbanov <svarbanov@mm-sol.com>2015-01-05 18:04:23 +0200
committerMichael Turquette <mturquette@linaro.org>2015-01-17 11:33:57 -0800
commitc7662fc59ca38517e0ec04ceaa123ed8209ab6bf (patch)
tree1558b888ae88613c645fdc15eecbe253492618d3
parent176a107b868781c8d6868454aea7d07e0b82d6b8 (diff)
downloadlinux-sh-c7662fc59ca38517e0ec04ceaa123ed8209ab6bf.tar.gz
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>
-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);