[PATCH 2/2] UMS: Fix comparison of unsigned variable against < 0.

Michel Dänzer michel at daenzer.net
Thu May 12 01:07:26 PDT 2011


From: Michel Dänzer <daenzer at vmware.com>

Pointed out by clang:

../../src/radeon_crtc.c:242:18: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare]
                        error = error < 0 ? 0xffffffff : error;
                                ~~~~~ ^ ~
---

Is this what was intended? And will it work as intended, or cause subtle
regressions? :}

 src/radeon_crtc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/radeon_crtc.c b/src/radeon_crtc.c
index d84112e..3c03700 100644
--- a/src/radeon_crtc.c
+++ b/src/radeon_crtc.c
@@ -239,7 +239,7 @@ RADEONComputePLL_old(RADEONPLLPtr pll,
 
 		    if (flags & RADEON_PLL_PREFER_CLOSEST_LOWER) {
 			error = freq - current_freq;
-			error = error < 0 ? 0xffffffff : error;
+			error = (int32_t)error < 0 ? 0xffffffff : error;
 		    } else
 			error = abs(current_freq - freq);
 		    vco_diff = abs(vco - best_vco);
-- 
1.7.5.1



More information about the xorg-driver-ati mailing list