From 82b2b1e8987c182d14fcaf5a3a3b8ee1b4d5e1df Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 28 Sep 2022 08:53:17 +0200 Subject: [PATCH] amdgpu: silence uninitialized variable warning MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The compiler isn't smart enough to tell that this can't happen: [30/74] Compiling C object amdgpu/libdrm_amdgpu.so.1.0.0.p/amdgpu_bo.c.o In file included from ../amdgpu/amdgpu_internal.h:32, from ../amdgpu/amdgpu_bo.c:39: ../xf86atomic.h: In function ‘amdgpu_find_bo_by_cpu_mapping’: ../xf86atomic.h:47:54: warning: ‘bo’ may be used uninitialized [-Wmaybe-uninitialized] 47 | # define atomic_inc(x) ((void) __sync_fetch_and_add (&(x)->atomic, 1)) | ^ ../amdgpu/amdgpu_bo.c:536:27: note: ‘bo’ was declared here 536 | struct amdgpu_bo *bo; | ^~ Signed-off-by: Simon Ser Reviewed-by: Alex Deucher --- amdgpu/amdgpu_bo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c index 54b1fb9..f4e0435 100644 --- a/amdgpu/amdgpu_bo.c +++ b/amdgpu/amdgpu_bo.c @@ -533,7 +533,7 @@ drm_public int amdgpu_find_bo_by_cpu_mapping(amdgpu_device_handle dev, amdgpu_bo_handle *buf_handle, uint64_t *offset_in_bo) { - struct amdgpu_bo *bo; + struct amdgpu_bo *bo = NULL; uint32_t i; int r = 0; -- 2.7.4