drivers/gpu/drm/radeon/radeon_ttm.c:201:27: warning: variable 'rbo' set but not used

From: kernel test robot
Date: Thu Apr 27 2023 - 18:32:35 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: cec24b8b6bb841a19b5c5555b600a511a8988100
commit: f87c1f0b7b79b7a4f165750d1884da1fd29ae93c drm/ttm: prevent moving of pinned BOs
date: 3 months ago
config: alpha-buildonly-randconfig-r002-20230427 (https://download.01.org/0day-ci/archive/20230428/202304280626.8qfHQcED-lkp@xxxxxxxxx/config)
compiler: alpha-linux-gcc (GCC) 12.1.0
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://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f87c1f0b7b79b7a4f165750d1884da1fd29ae93c
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout f87c1f0b7b79b7a4f165750d1884da1fd29ae93c
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=alpha olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=alpha SHELL=/bin/bash drivers/gpu/drm/radeon/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202304280626.8qfHQcED-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

drivers/gpu/drm/radeon/radeon_ttm.c: In function 'radeon_bo_move':
>> drivers/gpu/drm/radeon/radeon_ttm.c:201:27: warning: variable 'rbo' set but not used [-Wunused-but-set-variable]
201 | struct radeon_bo *rbo;
| ^~~


vim +/rbo +201 drivers/gpu/drm/radeon/radeon_ttm.c

771fe6b912fca5 Jerome Glisse 2009-06-05 193
2823f4f019d888 Christian König 2017-04-26 194 static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict,
2823f4f019d888 Christian König 2017-04-26 195 struct ttm_operation_ctx *ctx,
ebdf565169af00 Dave Airlie 2020-10-29 196 struct ttm_resource *new_mem,
ebdf565169af00 Dave Airlie 2020-10-29 197 struct ttm_place *hop)
771fe6b912fca5 Jerome Glisse 2009-06-05 198 {
d3116756a710e3 Christian König 2021-04-12 199 struct ttm_resource *old_mem = bo->resource;
771fe6b912fca5 Jerome Glisse 2009-06-05 200 struct radeon_device *rdev;
e1a575ada8d2a3 Michel Dänzer 2016-03-28 @201 struct radeon_bo *rbo;
a32ba6bdca21fd Christian König 2021-07-12 202 int r;
771fe6b912fca5 Jerome Glisse 2009-06-05 203
bfe5e585b44fb8 Dave Airlie 2020-10-20 204 if (new_mem->mem_type == TTM_PL_TT) {
bfe5e585b44fb8 Dave Airlie 2020-10-20 205 r = radeon_ttm_tt_bind(bo->bdev, bo->ttm, new_mem);
bfe5e585b44fb8 Dave Airlie 2020-10-20 206 if (r)
bfe5e585b44fb8 Dave Airlie 2020-10-20 207 return r;
bfe5e585b44fb8 Dave Airlie 2020-10-20 208 }
6d820003295977 Dave Airlie 2020-10-20 209
0ef1ed813e6b13 Dave Airlie 2020-09-23 210 r = ttm_bo_wait_ctx(bo, ctx);
88932a7be27d89 Christian König 2016-06-06 211 if (r)
9afdda82ee7f69 Christian König 2020-11-25 212 return r;
88932a7be27d89 Christian König 2016-06-06 213
e1a575ada8d2a3 Michel Dänzer 2016-03-28 214 rbo = container_of(bo, struct radeon_bo, tbo);
771fe6b912fca5 Jerome Glisse 2009-06-05 215 rdev = radeon_get_rdev(bo->bdev);
771fe6b912fca5 Jerome Glisse 2009-06-05 216 if (old_mem->mem_type == TTM_PL_SYSTEM && bo->ttm == NULL) {
ecfe6953fa0011 Dave Airlie 2020-09-08 217 ttm_bo_move_null(bo, new_mem);
9afdda82ee7f69 Christian König 2020-11-25 218 goto out;
771fe6b912fca5 Jerome Glisse 2009-06-05 219 }
51e50e54220432 Dave Airlie 2020-09-24 220 if (old_mem->mem_type == TTM_PL_SYSTEM &&
51e50e54220432 Dave Airlie 2020-09-24 221 new_mem->mem_type == TTM_PL_TT) {
ecfe6953fa0011 Dave Airlie 2020-09-08 222 ttm_bo_move_null(bo, new_mem);
9afdda82ee7f69 Christian König 2020-11-25 223 goto out;
771fe6b912fca5 Jerome Glisse 2009-06-05 224 }
51e50e54220432 Dave Airlie 2020-09-24 225
51e50e54220432 Dave Airlie 2020-09-24 226 if (old_mem->mem_type == TTM_PL_TT &&
c37d951cb42aa3 Dave Airlie 2020-10-19 227 new_mem->mem_type == TTM_PL_SYSTEM) {
29a1d482e4044a Dave Airlie 2020-10-20 228 radeon_ttm_tt_unbind(bo->bdev, bo->ttm);
bfa3357ef9abc9 Christian König 2021-04-15 229 ttm_resource_free(bo, &bo->resource);
c37d951cb42aa3 Dave Airlie 2020-10-19 230 ttm_bo_assign_mem(bo, new_mem);
9afdda82ee7f69 Christian König 2020-11-25 231 goto out;
c37d951cb42aa3 Dave Airlie 2020-10-19 232 }
9afdda82ee7f69 Christian König 2020-11-25 233 if (rdev->ring[radeon_copy_ring_index(rdev)].ready &&
9afdda82ee7f69 Christian König 2020-11-25 234 rdev->asic->copy.copy != NULL) {
9afdda82ee7f69 Christian König 2020-11-25 235 if ((old_mem->mem_type == TTM_PL_SYSTEM &&
9afdda82ee7f69 Christian König 2020-11-25 236 new_mem->mem_type == TTM_PL_VRAM) ||
9afdda82ee7f69 Christian König 2020-11-25 237 (old_mem->mem_type == TTM_PL_VRAM &&
9afdda82ee7f69 Christian König 2020-11-25 238 new_mem->mem_type == TTM_PL_SYSTEM)) {
9afdda82ee7f69 Christian König 2020-11-25 239 hop->fpfn = 0;
9afdda82ee7f69 Christian König 2020-11-25 240 hop->lpfn = 0;
9afdda82ee7f69 Christian König 2020-11-25 241 hop->mem_type = TTM_PL_TT;
9afdda82ee7f69 Christian König 2020-11-25 242 hop->flags = 0;
9afdda82ee7f69 Christian König 2020-11-25 243 return -EMULTIHOP;
771fe6b912fca5 Jerome Glisse 2009-06-05 244 }
771fe6b912fca5 Jerome Glisse 2009-06-05 245
28a68f82826675 Dave Airlie 2020-10-29 246 r = radeon_move_blit(bo, evict, new_mem, old_mem);
9afdda82ee7f69 Christian König 2020-11-25 247 } else {
9afdda82ee7f69 Christian König 2020-11-25 248 r = -ENODEV;
9afdda82ee7f69 Christian König 2020-11-25 249 }
9afdda82ee7f69 Christian König 2020-11-25 250
1ab2e1059916b9 Michel Dänzer 2009-07-28 251 if (r) {
3e98d829ad0a59 Roger He 2017-12-08 252 r = ttm_bo_move_memcpy(bo, ctx, new_mem);
9afdda82ee7f69 Christian König 2020-11-25 253 if (r)
9afdda82ee7f69 Christian König 2020-11-25 254 return r;
67e8e3f970ad74 Marek Olšák 2014-03-02 255 }
67e8e3f970ad74 Marek Olšák 2014-03-02 256
9afdda82ee7f69 Christian König 2020-11-25 257 out:
67e8e3f970ad74 Marek Olšák 2014-03-02 258 /* update statistics */
e11bfb99d6ece2 Christian König 2020-12-09 259 atomic64_add(bo->base.size, &rdev->num_bytes_moved);
a32ba6bdca21fd Christian König 2021-07-12 260 radeon_bo_move_notify(bo);
67e8e3f970ad74 Marek Olšák 2014-03-02 261 return 0;
67e8e3f970ad74 Marek Olšák 2014-03-02 262 }
771fe6b912fca5 Jerome Glisse 2009-06-05 263

:::::: The code at line 201 was first introduced by commit
:::::: e1a575ada8d2a3c3f107fdd12ac9215f983a7c80 drm/radeon: Don't move pinned BOs

:::::: TO: Michel Dänzer <michel.daenzer@xxxxxxx>
:::::: CC: Alex Deucher <alexander.deucher@xxxxxxx>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests