clk: qcom: Fix null pointer exception

Add null pointer check before dereferencing pointers.

Change-Id: I9d96a3d0e7d00ffc2c2eb83a0d2384a21fe994ae
Signed-off-by: Amit Nischal <anischal@codeaurora.org>
This commit is contained in:
Amit Nischal 2017-03-07 15:51:47 +05:30
parent 783427f7ad
commit 3e6f31c583

View file

@ -580,6 +580,9 @@ static int __clk_rcg2_set_rate(struct clk_hw *hw, unsigned long rate)
rcg->curr_index = 0;
else {
f = qcom_find_freq(rcg->freq_tbl, rcg->current_freq);
if (!f)
return -EINVAL;
rcg->curr_index = qcom_find_src_index(hw,
rcg->parent_map, f->src);