From 87d964c7ca8704a2435a857a045fec2580441670 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sat, 10 Aug 2024 21:08:35 +0800 Subject: [PATCH] GPU (Linux): fix uninited struct fields --- src/detection/gpu/gpu.h | 2 +- src/detection/gpu/gpu_linux.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/detection/gpu/gpu.h b/src/detection/gpu/gpu.h index 9737b4bfb..a914d5c2d 100644 --- a/src/detection/gpu/gpu.h +++ b/src/detection/gpu/gpu.h @@ -33,11 +33,11 @@ typedef struct FFGPUResult FFstrbuf driver; FFstrbuf platformApi; double temperature; + double coreUsage; int32_t coreCount; uint32_t frequency; // Maximum time clock frequency in MHz FFGPUMemory dedicated; FFGPUMemory shared; - double coreUsage; uint64_t deviceId; // Used internally, may be uninitialized } FFGPUResult; diff --git a/src/detection/gpu/gpu_linux.c b/src/detection/gpu/gpu_linux.c index b2e766b09..bcf1f2c91 100644 --- a/src/detection/gpu/gpu_linux.c +++ b/src/detection/gpu/gpu_linux.c @@ -299,6 +299,7 @@ static const char* detectPci(const FFGPUOptions* options, FFlist* gpus, FFstrbuf ffStrbufInit(&gpu->driver); ffStrbufInit(&gpu->platformApi); gpu->temperature = FF_GPU_TEMP_UNSET; + gpu->coreUsage = FF_GPU_CORE_USAGE_UNSET; gpu->coreCount = FF_GPU_CORE_COUNT_UNSET; gpu->type = FF_GPU_TYPE_UNKNOWN; gpu->dedicated.total = gpu->dedicated.used = gpu->shared.total = gpu->shared.used = FF_GPU_VMEM_SIZE_UNSET;