[patch] Re: drm2/radeon dfixed_trunc() warnings

From: Sean Bruno <sean_bruno_at_yahoo.com>
Date: Mon, 07 Oct 2013 12:04:36 -0700
On Sun, 2013-10-06 at 14:39 -0700, Sean Bruno wrote: 
> These caught my eye today, and the checks strewn about
> sys/dev/drm2/radeon seem completely bogus to me, but I don't have the
> h/w to test it at the moment.
> 
> /usr/src/sys/modules/drm2/radeonkms/../../../dev/drm2/radeon/rs690.c:491:37: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
>                 if (dfixed_trunc(priority_mark02) < 0)
> 
> 
> dfixed_trunc is a macro:
> drm_fixed.h:#define dfixed_trunc(A) ((A).full >> 12)
> 
> that returns the output of a shift right operation ... priority_mark02
> is of type union fixed20_12, single element union of type u32, so I
> can't see this check ever doing anything useful.
> 
> But, as always, I'm probably missing something obvious.  
> 
> Sean


Proposed patch to eliminate this check.  If I understand the macro
correctly, there's no way for these checks to ever do anything as bit
shifting an unsigned will simply clear out the value.  So, the check for
<0 is completely bogus?

Sean

http://people.freebsd.org/~sbruno/drm2_radeon_useless.txt 

Received on Mon Oct 07 2013 - 17:04:43 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:42 UTC