From fb3eb9666eed8e1a024e85b88843e0e612984950 Mon Sep 17 00:00:00 2001 From: Linus Dierheimer Date: Mon, 19 Sep 2022 16:43:43 +0200 Subject: [PATCH] Fix build with older libpci versions --- src/detection/gpu/gpu_linux.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/detection/gpu/gpu_linux.c b/src/detection/gpu/gpu_linux.c index 1e7a6764b..7357d5050 100644 --- a/src/detection/gpu/gpu_linux.c +++ b/src/detection/gpu/gpu_linux.c @@ -61,17 +61,16 @@ static void pciDetectVendorName(FFGPUResult* gpu, PCIData* pci, struct pci_dev* static void drmDetectDeviceName(FFGPUResult* gpu, PCIData* pci, struct pci_dev* device) { + bool revIdSet = false; + #if PCI_LIB_VERSION >= 0x030800 - pci->ffpci_fill_info(device, PCI_FILL_CLASS_EXT); - #endif - - #ifndef __FreeBSD__ - if((device->known_fields & PCI_FILL_CLASS_EXT) == 0) - device->rev_id = pci->ffpci_read_byte(device, PCI_REVISION_ID); - #endif - - if((device->known_fields & PCI_FILL_CLASS) == 0) + revIdSet = pci->ffpci_fill_info(device, PCI_FILL_CLASS_EXT) & PCI_FILL_CLASS_EXT; + #elif __FreeBSD__ return; + #endif + + if(!revIdSet) + device->rev_id = pci->ffpci_read_byte(device, PCI_REVISION_ID); FFstrbuf query; ffStrbufInit(&query);