Skip to content

Commit

Permalink
clk: ti: dra7-atl: Provide error check for incoming parameters in set…
Browse files Browse the repository at this point in the history
…_rate

Check for valid parameters in check rate. Else, we end up getting
errors.

This occurs as part of the inital clock tree update of child clock
nodes where new_rate could be 0 for non functional clocks.

Fixes: 9ac33b0 (" CLK: TI: Driver for DRA7 ATL (Audio Tracking Logic)")
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
  • Loading branch information
Nishanth Menon authored and Tero Kristo committed Aug 21, 2014
1 parent 2f10325 commit 20411da
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/clk/ti/clk-dra7-atl.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,13 @@ static long atl_clk_round_rate(struct clk_hw *hw, unsigned long rate,
static int atl_clk_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{
struct dra7_atl_desc *cdesc = to_atl_desc(hw);
struct dra7_atl_desc *cdesc;
u32 divider;

if (!hw || !rate)
return -EINVAL;

cdesc = to_atl_desc(hw);
divider = ((parent_rate + rate / 2) / rate) - 1;
if (divider > DRA7_ATL_DIVIDER_MASK)
divider = DRA7_ATL_DIVIDER_MASK;
Expand Down

0 comments on commit 20411da

Please sign in to comment.