mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 21:59:12 -04:00
clk: Add additional checking to some clock driver functions
Fix certain functions with potential for a NULL pointer de-reference. Change-Id: I855ef1d883a22616db7086bd5d47ee1f8e54694a Signed-off-by: Deepak Katragadda <dkatraga@codeaurora.org> Signed-off-by: David Dai <daidavid1@codeaurora.org> Signed-off-by: David Collins <collinsd@codeaurora.org>
This commit is contained in:
parent
a41cfccad5
commit
b3394e839b
2 changed files with 4 additions and 2 deletions
|
|
@ -295,6 +295,9 @@ static int clk_divider_bestdiv(struct clk_hw *hw, struct clk_hw *parent,
|
|||
unsigned long parent_rate, best = 0, now, maxdiv;
|
||||
unsigned long parent_rate_saved = *best_parent_rate;
|
||||
|
||||
if (!hw || !parent)
|
||||
return -EINVAL;
|
||||
|
||||
if (!rate)
|
||||
rate = 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -954,15 +954,14 @@ static int clk_dp_set_rate(struct clk_hw *hw, unsigned long rate,
|
|||
unsigned long parent_rate)
|
||||
{
|
||||
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
|
||||
struct clk_hw *parent = clk_hw_get_parent(hw);
|
||||
struct freq_tbl f = { 0 };
|
||||
unsigned long src_rate;
|
||||
unsigned long num, den;
|
||||
u32 mask = BIT(rcg->hid_width) - 1;
|
||||
u32 hid_div, cfg;
|
||||
int i, num_parents = clk_hw_get_num_parents(hw);
|
||||
struct clk_hw *parent;
|
||||
|
||||
parent = clk_hw_get_parent(hw);
|
||||
if (!parent)
|
||||
return -EINVAL;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue