drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:236:3: warning: variable 'usage' is uninitialized when used here

From: kernel test robot
Date: Mon Sep 27 2021 - 20:25:39 EST


tree: https://github.com/0day-ci/linux/commits/Arunpravin/Enable-buddy-memory-manager-support/20210921-032602
head: 71b3775a5ce7b59e8c5292ae438284e8569c9e9f
commit: 71b3775a5ce7b59e8c5292ae438284e8569c9e9f Add drm buddy manager support to amdgpu driver
date: 7 days ago
config: x86_64-randconfig-a014-20210927 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
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
# https://github.com/0day-ci/linux/commit/71b3775a5ce7b59e8c5292ae438284e8569c9e9f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Arunpravin/Enable-buddy-memory-manager-support/20210921-032602
git checkout 71b3775a5ce7b59e8c5292ae438284e8569c9e9f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:236:3: warning: variable 'usage' is uninitialized when used here [-Wuninitialized]
usage += amdgpu_vram_mgr_vis_size(adev, block);
^~~~~
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:227:11: note: initialize the variable 'usage' to silence this warning
u64 usage;
^
= 0
1 warning generated.


vim +/usage +236 drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c

212
213 /**
214 * amdgpu_vram_mgr_bo_visible_size - CPU visible BO size
215 *
216 * @bo: &amdgpu_bo buffer object (must be in VRAM)
217 *
218 * Returns:
219 * How much of the given &amdgpu_bo buffer object lies in CPU visible VRAM.
220 */
221 u64 amdgpu_vram_mgr_bo_visible_size(struct amdgpu_bo *bo)
222 {
223 struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
224 struct ttm_resource *res = bo->tbo.resource;
225 struct amdgpu_vram_mgr_node *vnode = to_amdgpu_vram_mgr_node(res);
226 struct drm_buddy_block *block;
227 u64 usage;
228
229 if (amdgpu_gmc_vram_full_visible(&adev->gmc))
230 return amdgpu_bo_size(bo);
231
232 if (res->start >= adev->gmc.visible_vram_size >> PAGE_SHIFT)
233 return 0;
234
235 list_for_each_entry(block, &vnode->blocks, link)
> 236 usage += amdgpu_vram_mgr_vis_size(adev, block);
237
238 return usage;
239 }
240

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip