amdgpu: silence uninitialized variable warning
authorSimon Ser <contact@emersion.fr>
Wed, 28 Sep 2022 06:53:17 +0000 (08:53 +0200)
committerSimon Ser <contact@emersion.fr>
Sun, 23 Oct 2022 15:47:24 +0000 (17:47 +0200)
commit82b2b1e8987c182d14fcaf5a3a3b8ee1b4d5e1df
tree528485ec6c875c981764eb67b51eb5e1d6a9b337
parenta81b9ab8f3fb6840b36f732c1dd25fe5e0d68d0a
amdgpu: silence uninitialized variable warning

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 <contact@emersion.fr>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
amdgpu/amdgpu_bo.c