[PATCH v2 xserver 1/3] xfree86: Silence always true condition warning.

Michal Srb msrb at suse.com
Mon Mar 27 15:36:58 UTC 2017


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.

v2: Merge the snprintf into the following XNFasprintf.
---
 hw/xfree86/common/xf86pciBus.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index 9adfee5..d589ece 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -1456,19 +1456,12 @@ void
 xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo,
                        GDevRec * GDev, int *chipset)
 {
-    char busnum[8];
     char *tmp;
 
     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);
-
-    XNFasprintf(&tmp, "PCI:%s:%d:%d",
-                busnum, pVideo->dev, pVideo->func);
+    XNFasprintf(&tmp, "PCI:%d:%d:%d",
+                pVideo->bus, pVideo->dev, pVideo->func);
     GDev->busID = tmp;
 
     GDev->chipID = pVideo->device_id;
-- 
2.10.2



More information about the xorg-devel mailing list