* [PATCH] aty128fb: test below 0 on unsigned pll->post_divider
@ 2008-04-23 18:37 Roel Kluin
2008-04-23 19:24 ` [PATCH v2] " Roel Kluin
0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2008-04-23 18:37 UTC (permalink / raw)
To: adaplas, linux-fbdev-devel, lkml
pll->post_divider is unsigned, so the test fails
Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
---
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
index cbd3308..5617259 100644
--- a/drivers/video/aty/aty128fb.c
+++ b/drivers/video/aty/aty128fb.c
@@ -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
^ permalink raw reply related [flat|nested] 2+ messages in thread* [PATCH v2] aty128fb: test below 0 on unsigned pll->post_divider
2008-04-23 18:37 [PATCH] aty128fb: test below 0 on unsigned pll->post_divider Roel Kluin
@ 2008-04-23 19:24 ` Roel Kluin
0 siblings, 0 replies; 2+ messages in thread
From: Roel Kluin @ 2008-04-23 19:24 UTC (permalink / raw)
To: adaplas, linux-fbdev-devel, lkml, Joe Perches
Joe Perches wrote:
>
> In both uses, sizeof(post_dividers) should be ARRAY_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
Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
---
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
index cbd3308..5049228 100644
--- a/drivers/video/aty/aty128fb.c
+++ b/drivers/video/aty/aty128fb.c
@@ -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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-04-23 19:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-23 18:37 [PATCH] aty128fb: test below 0 on unsigned pll->post_divider Roel Kluin
2008-04-23 19:24 ` [PATCH v2] " Roel Kluin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).