提交 816664f8 编写于 作者: R Roel Kluin 提交者: Linus Torvalds

aty128fb: test below 0 on unsigned pll->post_divider

pll->post_divider is unsigned, so the test fails
Signed-off-by: NRoel Kluin <12o3l@tiscali.nl>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Antonino Daplas <adaplas@pol.net>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 fcea8030
......@@ -1339,10 +1339,8 @@ static int aty128_var_to_pll(u32 period_in_ps, struct aty128_pll *pll,
if (vclk * 12 < c.ppll_min)
vclk = c.ppll_min/12;
pll->post_divider = -1;
/* now, find an acceptable divider */
for (i = 0; i < sizeof(post_dividers); i++) {
for (i = 0; i < ARRAY_SIZE(post_dividers); i++) {
output_freq = post_dividers[i] * vclk;
if (output_freq >= c.ppll_min && output_freq <= c.ppll_max) {
pll->post_divider = post_dividers[i];
......@@ -1350,7 +1348,7 @@ static int aty128_var_to_pll(u32 period_in_ps, struct aty128_pll *pll,
}
}
if (pll->post_divider < 0)
if (i == ARRAY_SIZE(post_dividers))
return -EINVAL;
/* calculate feedback divider */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册