From: Stanimir Varbanov Date: Mon, 5 Jan 2015 16:04:23 +0000 (+0200) Subject: clk: fix possible null pointer dereference X-Git-Tag: MMI-PSA29.97-13-9~10805^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c7662fc59ca38517e0ec04ceaa123ed8209ab6bf;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git 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 Reviewed-by: Stephen Boyd Signed-off-by: Michael Turquette --- 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);