* [linux-next:master 8949/9357] drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:362:6: warning: variable 'index' is used uninitialized whenever 'if' condition is true
@ 2022-05-05 17:54 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-05-05 17:54 UTC (permalink / raw)
To: Hawking Zhang
Cc: llvm, kbuild-all, Linux Memory Management List, Alex Deucher,
Wenhui Sheng
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 632a8c88e339fe86ae6e420a24dfc641d4dd0ab5
commit: 3d879e81f0f9ed5d33b5eda0fe5226c884bb8073 [8949/9357] drm/amdgpu: add init support for GFX11 (v2)
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20220506/202205060132.uhqyUx1l-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 5e004fb787698440a387750db7f8028e7cb14cfc)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=3d879e81f0f9ed5d33b5eda0fe5226c884bb8073
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout 3d879e81f0f9ed5d33b5eda0fe5226c884bb8073
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/gpu/drm/amd/amdgpu/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:362:6: warning: variable 'index' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (ring->is_mes_queue) {
^~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:419:30: note: uninitialized use occurs here
amdgpu_device_wb_free(adev, index);
^~~~~
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:362:2: note: remove the 'if' if its condition is always false
if (ring->is_mes_queue) {
^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:350:16: note: initialize the variable 'index' to silence this warning
unsigned index;
^
= 0
>> drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:1945:6: warning: no previous prototype for function 'gfx_v11_0_rlc_stop' [-Wmissing-prototypes]
void gfx_v11_0_rlc_stop(struct amdgpu_device *adev)
^
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:1945:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void gfx_v11_0_rlc_stop(struct amdgpu_device *adev)
^
static
>> drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:5873:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
default:
^
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:5873:2: note: insert 'break;' to avoid fall-through
default:
^
break;
3 warnings generated.
vim +362 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
344
345 static int gfx_v11_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
346 {
347 struct amdgpu_device *adev = ring->adev;
348 struct amdgpu_ib ib;
349 struct dma_fence *f = NULL;
350 unsigned index;
351 uint64_t gpu_addr;
352 volatile uint32_t *cpu_ptr;
353 long r;
354
355 /* MES KIQ fw hasn't indirect buffer support for now */
356 if (adev->enable_mes_kiq &&
357 ring->funcs->type == AMDGPU_RING_TYPE_KIQ)
358 return 0;
359
360 memset(&ib, 0, sizeof(ib));
361
> 362 if (ring->is_mes_queue) {
363 uint32_t padding, offset;
364
365 offset = amdgpu_mes_ctx_get_offs(ring, AMDGPU_MES_CTX_IB_OFFS);
366 padding = amdgpu_mes_ctx_get_offs(ring,
367 AMDGPU_MES_CTX_PADDING_OFFS);
368
369 ib.gpu_addr = amdgpu_mes_ctx_get_offs_gpu_addr(ring, offset);
370 ib.ptr = amdgpu_mes_ctx_get_offs_cpu_addr(ring, offset);
371
372 gpu_addr = amdgpu_mes_ctx_get_offs_gpu_addr(ring, padding);
373 cpu_ptr = amdgpu_mes_ctx_get_offs_cpu_addr(ring, padding);
374 *cpu_ptr = cpu_to_le32(0xCAFEDEAD);
375 } else {
376 r = amdgpu_device_wb_get(adev, &index);
377 if (r)
378 return r;
379
380 gpu_addr = adev->wb.gpu_addr + (index * 4);
381 adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD);
382 cpu_ptr = &adev->wb.wb[index];
383
384 r = amdgpu_ib_get(adev, NULL, 16, AMDGPU_IB_POOL_DIRECT, &ib);
385 if (r) {
386 DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r);
387 goto err1;
388 }
389 }
390
391 ib.ptr[0] = PACKET3(PACKET3_WRITE_DATA, 3);
392 ib.ptr[1] = WRITE_DATA_DST_SEL(5) | WR_CONFIRM;
393 ib.ptr[2] = lower_32_bits(gpu_addr);
394 ib.ptr[3] = upper_32_bits(gpu_addr);
395 ib.ptr[4] = 0xDEADBEEF;
396 ib.length_dw = 5;
397
398 r = amdgpu_ib_schedule(ring, 1, &ib, NULL, &f);
399 if (r)
400 goto err2;
401
402 r = dma_fence_wait_timeout(f, false, timeout);
403 if (r == 0) {
404 r = -ETIMEDOUT;
405 goto err2;
406 } else if (r < 0) {
407 goto err2;
408 }
409
410 if (le32_to_cpu(*cpu_ptr) == 0xDEADBEEF)
411 r = 0;
412 else
413 r = -EINVAL;
414 err2:
415 if (!ring->is_mes_queue)
416 amdgpu_ib_free(adev, &ib, NULL);
417 dma_fence_put(f);
418 err1:
419 amdgpu_device_wb_free(adev, index);
420 return r;
421 }
422
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-05 17:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-05 17:54 [linux-next:master 8949/9357] drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:362:6: warning: variable 'index' is used uninitialized whenever 'if' condition is true kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox