From d45dc53da0ebc766956dc351069b5fac2fcca05b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 26 Mar 2026 22:53:43 +0800 Subject: [PATCH] GPU (OpenBSD): silences compiler warnings --- src/detection/gpu/gpu_obsd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/detection/gpu/gpu_obsd.c b/src/detection/gpu/gpu_obsd.c index 95e1dff31..f4e0e107c 100644 --- a/src/detection/gpu/gpu_obsd.c +++ b/src/detection/gpu/gpu_obsd.c @@ -8,7 +8,7 @@ #include #include -static inline int pciReadConf(int fd, uint32_t bus, uint32_t device, uint32_t func, uint32_t reg, uint32_t* result) +static inline int pciReadConf(int fd, uint8_t bus, uint8_t device, uint8_t func, uint8_t reg, uint32_t* result) { struct pci_io bdfr = { .pi_sel = { @@ -34,12 +34,12 @@ const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist* if (pcifd < 0) return "open(\"/dev/pci0\", O_RDONLY | O_CLOEXEC) failed"; - for (uint32_t bus = 0; bus <= 255; bus++) + for (uint16_t bus = 0; bus <= 255; bus++) { - for (uint32_t dev = 0; dev < 32; dev++) + for (uint8_t dev = 0; dev < 32; dev++) { - uint32_t maxfuncs = 0; - for (uint32_t func = 0; func <= maxfuncs; func++) + uint8_t maxfuncs = 0; + for (uint8_t func = 0; func <= maxfuncs; func++) { uint32_t pciid, pciclass; if (pciReadConf(pcifd, bus, dev, func, PCI_ID_REG, &pciid) != 0) @@ -56,7 +56,7 @@ const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist* // For some reason, pciReadConf returns success even for non-existing devices. // So we need to check for `PCI_VENDOR(pciid) == PCI_VENDOR_INVALID` above to filter them out. uint32_t bhlcr; - if (pciReadConf(pcifd, bus, dev, 0, PCI_BHLC_REG, &bhlcr) != 0) + if (pciReadConf(pcifd, (uint8_t) bus, dev, 0, PCI_BHLC_REG, &bhlcr) != 0) continue; if (PCI_HDRTYPE_MULTIFN(bhlcr)) maxfuncs = 7;