[PATCH:xf86-video-s3] When checking malloc for success, it helps to use == NULL, instead of =

Adam Jackson ajax at nwnk.net
Mon Mar 14 14:28:38 UTC 2016


On Sat, 2016-03-12 at 11:02 -0800, Alan Coopersmith wrote:
> Fixes gcc 5.3 compiler warning:
> s3_bios.c: In function 'find_bios_string':
> s3_bios.c:49:2: warning: suggest parentheses around assignment used as
>     truth value [-Wparentheses]
>   if (bios = NULL)
>     ^
> 
> [Tested by compiling only, as I have no S3 hardware, but clearly no one
>  else has tested this code since commit c41a1188ce53 in 2009, as it would
>  be segfaulting if run.]

Indeed, Fedora dropped this driver circa January 2008. I'm not sure I
even have any, I think my oldest S3 cards are all Virges. And at this
point, if electrons were sentient, forcing them to move through an S3
Trio would be abuse.

However, the only caller of find_bios_string looks like:

int S3GetRefClock(ScrnInfoPtr pScrn)
{
        int RefClock = 16000;   /* default */

        if (find_bios_string(pScrn, BIOS_BASE, "Number Nine Visual Technology",
                                        "Motion 771") != NULL)
                RefClock = 16000;

        return RefClock;
}

Pretty sure that can be simplified further.

- ajax


More information about the xorg-devel mailing list