[PATCH xserver 1/3] xfree86: Silence always true condition warning.
walter harms
wharms at bfs.de
Mon Mar 27 12:08:52 UTC 2017
Am 27.03.2017 14:03, schrieb msrb at suse.com:
> From: Michal Srb <msrb at suse.com>
>
> xf86pciBus.c:1464:21: warning: comparison of constant 256 with expression of type 'uint8_t' (aka 'unsigned char') is always true [-Wtautological-constant-out-of-range-compare]
> if (pVideo->bus < 256)
>
> The code used to be in xf86FormatPciBusNumber and compared parameter which was int, but since b967bf2a it was inlined now it works with uint8_t.
> ---
> hw/xfree86/common/xf86pciBus.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
> index 9adfee5..ae03b75 100644
> --- a/hw/xfree86/common/xf86pciBus.c
> +++ b/hw/xfree86/common/xf86pciBus.c
> @@ -1461,11 +1461,7 @@ xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo,
>
> pVideo = (struct pci_device *) busData;
>
> - if (pVideo->bus < 256)
> - snprintf(busnum, sizeof(busnum), "%d", pVideo->bus);
> - else
> - snprintf(busnum, sizeof(busnum), "%d@%d",
> - pVideo->bus & 0x00ff, pVideo->bus >> 8);
> + snprintf(busnum, sizeof(busnum), "%d", pVideo->bus);
>
> XNFasprintf(&tmp, "PCI:%s:%d:%d",
> busnum, pVideo->dev, pVideo->func);
is busnum used later ? otherwise you could use the XNFasprintf().
re,
wh
More information about the xorg-devel
mailing list