mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
clk: rockchip: half-divider: Fix error value when bestdiv is zero
Zero is a valid value for half-divider. Change-Id: I23aa8afcd391da95396e5d808c3c424f993c66e3 Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com> Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
This commit is contained in:
@@ -38,6 +38,7 @@ static int clk_half_divider_bestdiv(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned int i, bestdiv = 0;
|
||||
unsigned long parent_rate, best = 0, now, maxdiv;
|
||||
unsigned long parent_rate_saved = *best_parent_rate;
|
||||
bool is_bestdiv = false;
|
||||
|
||||
if (!rate)
|
||||
rate = 1;
|
||||
@@ -77,13 +78,14 @@ static int clk_half_divider_bestdiv(struct clk_hw *hw, unsigned long rate,
|
||||
(i * 2 + 3));
|
||||
|
||||
if (_is_best_half_div(rate, now, best, flags)) {
|
||||
is_bestdiv = true;
|
||||
bestdiv = i;
|
||||
best = now;
|
||||
*best_parent_rate = parent_rate;
|
||||
}
|
||||
}
|
||||
|
||||
if (!bestdiv) {
|
||||
if (!is_bestdiv) {
|
||||
bestdiv = div_mask(width);
|
||||
*best_parent_rate = clk_hw_round_rate(clk_hw_get_parent(hw), 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user