From 831b467b2e3876c4e0c307d1e3eae2746ce805a7 Mon Sep 17 00:00:00 2001 From: Chester Gillon Date: Sun, 5 Sep 2021 13:37:56 +0100 Subject: Obtain correct value of is_64 and is_prefetchable PCI device fields Correct setting of the is_64 and is_prefetchable pci_device fields in pci_device_linux_sysfs_probe(). The pci_device struct defines is_64 and is_prefetchable as single bits, but the previous code was attempting to store the result of a bit-masked field in a single bit which always resulted in is_64 and is_prefetchable being zero regardless of the actual capabilities of the PCI device. Fixes: #15 Signed-off-by: Chester Gillon --- src/linux_sysfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/linux_sysfs.c b/src/linux_sysfs.c index d022644..d79404e 100644 --- a/src/linux_sysfs.c +++ b/src/linux_sysfs.c @@ -336,9 +336,9 @@ pci_device_linux_sysfs_probe( struct pci_device * dev ) dev->regions[i].size = (high_addr - dev->regions[i].base_addr) + 1; - dev->regions[i].is_IO = (flags & 0x01); - dev->regions[i].is_64 = (flags & 0x04); - dev->regions[i].is_prefetchable = (flags & 0x08); + dev->regions[i].is_IO = (flags & 0x01) != 0; + dev->regions[i].is_64 = (flags & 0x04) != 0; + dev->regions[i].is_prefetchable = (flags & 0x08) != 0; } } -- cgit v1.2.3