summaryrefslogtreecommitdiffstats
path: root/drivers/clk
diff options
context:
space:
mode:
authorStanimir Varbanov <svarbanov@mm-sol.com>2015-01-05 17:04:23 +0100
committerMichael Turquette <mturquette@linaro.org>2015-01-17 20:33:57 +0100
commitc7662fc59ca38517e0ec04ceaa123ed8209ab6bf (patch)
tree1558b888ae88613c645fdc15eecbe253492618d3 /drivers/clk
parentRevert "clk: ppc-corenet: Fix Section mismatch warning" (diff)
downloadlinux-c7662fc59ca38517e0ec04ceaa123ed8209ab6bf.tar.xz
linux-c7662fc59ca38517e0ec04ceaa123ed8209ab6bf.zip
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')
-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);