summaryrefslogtreecommitdiff
path: root/drivers/video/asiliantfb.c
diff options
context:
space:
mode:
authorRoel Kluin <roel.kluin@gmail.com>2010-03-11 02:21:23 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-13 02:52:32 +0300
commit0d3580d40cc38bbaf63d0b2756931e0ae241a9ea (patch)
treef449628dd8da7ecbdefb179c59b2317ab50c23f9 /drivers/video/asiliantfb.c
parent6e3e37a5a7c91045497553bcbd6a5faea98b21b3 (diff)
downloadlinux-0d3580d40cc38bbaf63d0b2756931e0ae241a9ea.tar.xz
asiliantfb: fix test of unsigned in asiliant_calc_dclk2()
Ftarget, Fret, n and m are unsigned so the tests did not work. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Cc: Andres Salomon <dilinger@debian.org> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/asiliantfb.c')
-rw-r--r--drivers/video/asiliantfb.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/video/asiliantfb.c b/drivers/video/asiliantfb.c
index 9fe90ce928fb..e70bc225fe31 100644
--- a/drivers/video/asiliantfb.c
+++ b/drivers/video/asiliantfb.c
@@ -140,7 +140,7 @@ static void asiliant_calc_dclk2(u32 *ppixclock, u8 *dclk2_m, u8 *dclk2_n, u8 *dc
/* 3 <= m <= 257 */
if (m >= 3 && m <= 257) {
- unsigned new_error = ((Ftarget * n) - (Fref * m)) >= 0 ?
+ unsigned new_error = Ftarget * n >= Fref * m ?
((Ftarget * n) - (Fref * m)) : ((Fref * m) - (Ftarget * n));
if (new_error < best_error) {
best_n = n;
@@ -152,7 +152,7 @@ static void asiliant_calc_dclk2(u32 *ppixclock, u8 *dclk2_m, u8 *dclk2_n, u8 *dc
else if (m <= 1028) {
/* remember there are still only 8-bits of precision in m, so
* avoid over-optimistic error calculations */
- unsigned new_error = ((Ftarget * n) - (Fref * (m & ~3))) >= 0 ?
+ unsigned new_error = Ftarget * n >= Fref * (m & ~3) ?
((Ftarget * n) - (Fref * (m & ~3))) : ((Fref * (m & ~3)) - (Ftarget * n));
if (new_error < best_error) {
best_n = n;