Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [mripard:cgroup-dmem-drm 3/4] drivers/gpu/drm/ttm/ttm_bo.c:461:2: warning: variable 'ret' is used uninitialized whenever 'if' condition is true
@ 2025-01-07 12:00 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-01-07 12:00 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: llvm, oe-kbuild-all, Maxime Ripard, Friedrich Vock

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux.git cgroup-dmem-drm
head:   aa4f9d7f77836d5a48daaa99479c2603e9a548ed
commit: 6627b2708ea9f8e3e3c2e6ee8d5d4bb277edad96 [3/4] drm/ttm: Handle cgroup based eviction in TTM
config: i386-buildonly-randconfig-002-20250107 (https://download.01.org/0day-ci/archive/20250107/202501071904.2ZS4kmtn-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250107/202501071904.2ZS4kmtn-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501071904.2ZS4kmtn-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/ttm/ttm_bo.c:461:2: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
     461 |         if (!ttm_bo_get_unless_zero(bo))
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:55:28: note: expanded from macro 'if'
      55 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:57:30: note: expanded from macro '__trace_if_var'
      57 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/ttm/ttm_bo.c:486:9: note: uninitialized use occurs here
     486 |         return ret;
         |                ^~~
   drivers/gpu/drm/ttm/ttm_bo.c:461:2: note: remove the 'if' if its condition is always false
     461 |         if (!ttm_bo_get_unless_zero(bo))
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     462 |                 goto out_no_ref;
         |                 ~~~~~~~~~~~~~~~
   include/linux/compiler.h:55:23: note: expanded from macro 'if'
      55 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                       ^
   drivers/gpu/drm/ttm/ttm_bo.c:451:9: note: initialize the variable 'ret' to silence this warning
     451 |         int ret;
         |                ^
         |                 = 0
   1 warning generated.
--
>> drivers/gpu/drm/ttm/ttm_bo.c:1097: warning: Function parameter or struct member 'hit_low' not described in 'ttm_bo_swapout_walk'
>> drivers/gpu/drm/ttm/ttm_bo.c:1097: warning: Function parameter or struct member 'evict_low' not described in 'ttm_bo_swapout_walk'


vim +461 drivers/gpu/drm/ttm/ttm_bo.c

a2ab19fed9d1dc Christian König   2016-08-30  435  
3756310e9fe1e0 Thomas Hellström  2024-07-05  436  /**
3756310e9fe1e0 Thomas Hellström  2024-07-05  437   * ttm_bo_evict_first() - Evict the first bo on the manager's LRU list.
3756310e9fe1e0 Thomas Hellström  2024-07-05  438   * @bdev: The ttm device.
3756310e9fe1e0 Thomas Hellström  2024-07-05  439   * @man: The manager whose bo to evict.
3756310e9fe1e0 Thomas Hellström  2024-07-05  440   * @ctx: The TTM operation ctx governing the eviction.
d5769ba315d8ff Roger He          2017-12-21  441   *
3756310e9fe1e0 Thomas Hellström  2024-07-05  442   * Return: 0 if successful or the resource disappeared. Negative error code on error.
d5769ba315d8ff Roger He          2017-12-21  443   */
3756310e9fe1e0 Thomas Hellström  2024-07-05  444  int ttm_bo_evict_first(struct ttm_device *bdev, struct ttm_resource_manager *man,
3756310e9fe1e0 Thomas Hellström  2024-07-05  445  		       struct ttm_operation_ctx *ctx)
d5769ba315d8ff Roger He          2017-12-21  446  {
3756310e9fe1e0 Thomas Hellström  2024-07-05  447  	struct ttm_resource_cursor cursor;
3756310e9fe1e0 Thomas Hellström  2024-07-05  448  	struct ttm_buffer_object *bo;
3756310e9fe1e0 Thomas Hellström  2024-07-05  449  	struct ttm_resource *res;
3756310e9fe1e0 Thomas Hellström  2024-07-05  450  	unsigned int mem_type;
6627b2708ea9f8 Maarten Lankhorst 2024-12-04  451  	int ret;
d5769ba315d8ff Roger He          2017-12-21  452  
3756310e9fe1e0 Thomas Hellström  2024-07-05  453  	spin_lock(&bdev->lru_lock);
3756310e9fe1e0 Thomas Hellström  2024-07-05  454  	res = ttm_resource_manager_first(man, &cursor);
3756310e9fe1e0 Thomas Hellström  2024-07-05  455  	ttm_resource_cursor_fini(&cursor);
3756310e9fe1e0 Thomas Hellström  2024-07-05  456  	if (!res) {
3756310e9fe1e0 Thomas Hellström  2024-07-05  457  		ret = -ENOENT;
3756310e9fe1e0 Thomas Hellström  2024-07-05  458  		goto out_no_ref;
a2848d08742c8e Christian König   2023-07-07  459  	}
3756310e9fe1e0 Thomas Hellström  2024-07-05  460  	bo = res->bo;
3756310e9fe1e0 Thomas Hellström  2024-07-05 @461  	if (!ttm_bo_get_unless_zero(bo))
3756310e9fe1e0 Thomas Hellström  2024-07-05  462  		goto out_no_ref;
3756310e9fe1e0 Thomas Hellström  2024-07-05  463  	mem_type = res->mem_type;
3756310e9fe1e0 Thomas Hellström  2024-07-05  464  	spin_unlock(&bdev->lru_lock);
3756310e9fe1e0 Thomas Hellström  2024-07-05  465  	ret = ttm_bo_reserve(bo, ctx->interruptible, ctx->no_wait_gpu, NULL);
3756310e9fe1e0 Thomas Hellström  2024-07-05  466  	if (ret)
3756310e9fe1e0 Thomas Hellström  2024-07-05  467  		goto out_no_lock;
3756310e9fe1e0 Thomas Hellström  2024-07-05  468  	if (!bo->resource || bo->resource->mem_type != mem_type)
3756310e9fe1e0 Thomas Hellström  2024-07-05  469  		goto out_bo_moved;
a2848d08742c8e Christian König   2023-07-07  470  
3756310e9fe1e0 Thomas Hellström  2024-07-05  471  	if (bo->deleted) {
3756310e9fe1e0 Thomas Hellström  2024-07-05  472  		ret = ttm_bo_wait_ctx(bo, ctx);
3756310e9fe1e0 Thomas Hellström  2024-07-05  473  		if (!ret)
3756310e9fe1e0 Thomas Hellström  2024-07-05  474  			ttm_bo_cleanup_memtype_use(bo);
d5769ba315d8ff Roger He          2017-12-21  475  	} else {
3756310e9fe1e0 Thomas Hellström  2024-07-05  476  		ret = ttm_bo_evict(bo, ctx);
d5769ba315d8ff Roger He          2017-12-21  477  	}
3756310e9fe1e0 Thomas Hellström  2024-07-05  478  out_bo_moved:
abb50d67adf3f0 Thomas Hellström  2021-06-02  479  	dma_resv_unlock(bo->base.resv);
3756310e9fe1e0 Thomas Hellström  2024-07-05  480  out_no_lock:
3756310e9fe1e0 Thomas Hellström  2024-07-05  481  	ttm_bo_put(bo);
3756310e9fe1e0 Thomas Hellström  2024-07-05  482  	return ret;
abb50d67adf3f0 Thomas Hellström  2021-06-02  483  
3756310e9fe1e0 Thomas Hellström  2024-07-05  484  out_no_ref:
3756310e9fe1e0 Thomas Hellström  2024-07-05  485  	spin_unlock(&bdev->lru_lock);
d5769ba315d8ff Roger He          2017-12-21  486  	return ret;
d5769ba315d8ff Roger He          2017-12-21  487  }
d5769ba315d8ff Roger He          2017-12-21  488  

:::::: The code at line 461 was first introduced by commit
:::::: 3756310e9fe1e0182adac89cedaa98c0eea66675 drm/ttm: Use the LRU walker for eviction

:::::: TO: Thomas Hellström <thomas.hellstrom@linux.intel.com>
:::::: CC: Christian König <christian.koenig@amd.com>

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-01-07 12:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-07 12:00 [mripard:cgroup-dmem-drm 3/4] drivers/gpu/drm/ttm/ttm_bo.c:461:2: warning: variable 'ret' 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