aty128fb: test below 0 on unsigned pll->post_divider
PATCH 1/1 aty128fb: test below 0 on unsigned pll->post_divider
pll->post_divider is unsigned, so the test fails
---
drivers/video/aty/aty128fb.c +1 -3
@@ -1339,8 +1339,6 @@ 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++) { output_freq = post_dividers[i] * vclk;
@@ -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 ==sizeof (post_dividers))return -EINVAL ;/* calculate feedback divider */
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
PATCH v2 1/1 aty128fb: test below 0 on unsigned pll->post_divider
Quoted 5 lines · Joe Perches
In both uses,
sizeof(post_dividers)should beARRAY_SIZE(post_dividers)Yes, it's an unsigned char array, it works, but it's unsightly.cheers, Joe
Thanks Joe, updated patch below
---pll->post_divider is unsigned, so the test fails
---
drivers/video/aty/aty128fb.c +2 -4
@@ -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 */
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone