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

Sean Bruno sean_bruno at yahoo.com
Mon Oct 7 19:04:44 UTC 2013


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 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freebsd.org/pipermail/freebsd-current/attachments/20131007/f3bb8a24/attachment.sig>


More information about the freebsd-current mailing list