divider_get_val can return a negative error code and should not be used as a valid divider. Signed-off-by: Jules Maselbas <jmaselbas@xxxxxxxx> --- drivers/clk/clk-divider.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c index ccab70aecc..b05b042da5 100644 --- a/drivers/clk/clk-divider.c +++ b/drivers/clk/clk-divider.c @@ -308,6 +308,7 @@ static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate, struct clk *clk = clk_hw_to_clk(hw); struct clk_divider *divider = to_clk_divider(hw); unsigned int value; + int ret; u32 val; if (divider->flags & CLK_DIVIDER_READ_ONLY) @@ -320,8 +321,10 @@ static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate, clk_set_rate(clk_get_parent(clk), parent_rate); } - value = divider_get_val(rate, parent_rate, divider->table, + value = ret = divider_get_val(rate, parent_rate, divider->table, divider->width, divider->flags); + if (ret < 0) + return ret; val = readl(divider->reg); val &= ~(clk_div_mask(divider->width) << divider->shift); -- 2.46.2