Re: [PATCH v6] drm: Optimise for continuous memory allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi xinhui,

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/xinhui-pan/drm-Optimise-for-continuous-memory-allocation/20221218-145922
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:    https://lore.kernel.org/r/20221218065708.93332-1-xinhui.pan%40amd.com
patch subject: [PATCH v6] drm: Optimise for continuous memory allocation
config: s390-randconfig-m041-20221218
compiler: s390-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <error27@xxxxxxxxx>

smatch warnings:
drivers/gpu/drm/drm_buddy.c:501 find_continuous_blocks() error: uninitialized symbol 'block'.

vim +/block +501 drivers/gpu/drm/drm_buddy.c

8a257b57bc11a2 xinhui pan 2022-12-18  472  static struct drm_buddy_block *
8a257b57bc11a2 xinhui pan 2022-12-18  473  find_continuous_blocks(struct drm_buddy *mm,
8a257b57bc11a2 xinhui pan 2022-12-18  474  		       int order,
8a257b57bc11a2 xinhui pan 2022-12-18  475  		       unsigned long flags,
8a257b57bc11a2 xinhui pan 2022-12-18  476  		       struct drm_buddy_block **lb)
8a257b57bc11a2 xinhui pan 2022-12-18  477  {
8a257b57bc11a2 xinhui pan 2022-12-18  478  	struct list_head *head = &mm->free_list[order - 1];
8a257b57bc11a2 xinhui pan 2022-12-18  479  	struct drm_buddy_block *free_block, *first = NULL, *last = NULL;
8a257b57bc11a2 xinhui pan 2022-12-18  480  
8a257b57bc11a2 xinhui pan 2022-12-18  481  	/*
8a257b57bc11a2 xinhui pan 2022-12-18  482  	 * Look for continuous free memory in buddy and buddy-in-law.
8a257b57bc11a2 xinhui pan 2022-12-18  483  	 * IOW, the most left blocks at right of free block and the most right
8a257b57bc11a2 xinhui pan 2022-12-18  484  	 * blocks at left of free block.
8a257b57bc11a2 xinhui pan 2022-12-18  485  	 */
8a257b57bc11a2 xinhui pan 2022-12-18  486  
8a257b57bc11a2 xinhui pan 2022-12-18  487  	list_for_each_entry(free_block, head, link) {
8a257b57bc11a2 xinhui pan 2022-12-18  488  		struct drm_buddy_block *buddy, *parent, *block;
8a257b57bc11a2 xinhui pan 2022-12-18  489  		int left, min_order = 0;
8a257b57bc11a2 xinhui pan 2022-12-18  490  		LIST_HEAD(fbl);
8a257b57bc11a2 xinhui pan 2022-12-18  491  
8a257b57bc11a2 xinhui pan 2022-12-18  492  		parent = free_block->parent;
8a257b57bc11a2 xinhui pan 2022-12-18  493  		if (!parent)
8a257b57bc11a2 xinhui pan 2022-12-18  494  			continue;
8a257b57bc11a2 xinhui pan 2022-12-18  495  
8a257b57bc11a2 xinhui pan 2022-12-18  496  		left = parent->left == free_block;
8a257b57bc11a2 xinhui pan 2022-12-18  497  		list_add(&free_block->tmp_link, &fbl);
8a257b57bc11a2 xinhui pan 2022-12-18  498  		buddy = __get_buddy(free_block);
8a257b57bc11a2 xinhui pan 2022-12-18  499  		__continuous_block_in_tree(buddy, &fbl, left, min_order);
8a257b57bc11a2 xinhui pan 2022-12-18  500  
8a257b57bc11a2 xinhui pan 2022-12-18 @501  		while (parent && !((parent->left == block) ^ left)) {
                                                                                            ^^^^^
Not initialized on first iteration.

8a257b57bc11a2 xinhui pan 2022-12-18  502  			block = parent;
8a257b57bc11a2 xinhui pan 2022-12-18  503  			parent = parent->parent;
8a257b57bc11a2 xinhui pan 2022-12-18  504  		}
8a257b57bc11a2 xinhui pan 2022-12-18  505  
8a257b57bc11a2 xinhui pan 2022-12-18  506  		if (!parent)
8a257b57bc11a2 xinhui pan 2022-12-18  507  			continue;
8a257b57bc11a2 xinhui pan 2022-12-18  508  
8a257b57bc11a2 xinhui pan 2022-12-18  509  		buddy = __get_buddy(block);
8a257b57bc11a2 xinhui pan 2022-12-18  510  		__continuous_block_in_tree(buddy, &fbl, !left, min_order);
8a257b57bc11a2 xinhui pan 2022-12-18  511  
8a257b57bc11a2 xinhui pan 2022-12-18  512  		/* list head of fbl is invalid outside.
8a257b57bc11a2 xinhui pan 2022-12-18  513  		 * Walk through list from first fo last only.
8a257b57bc11a2 xinhui pan 2022-12-18  514  		 */
8a257b57bc11a2 xinhui pan 2022-12-18  515  		if (__free_block_in_order(&fbl, free_block, order, &first, &last))
8a257b57bc11a2 xinhui pan 2022-12-18  516  			break;
8a257b57bc11a2 xinhui pan 2022-12-18  517  	}
8a257b57bc11a2 xinhui pan 2022-12-18  518  
8a257b57bc11a2 xinhui pan 2022-12-18  519  	*lb = last;
8a257b57bc11a2 xinhui pan 2022-12-18  520  	return first;
8a257b57bc11a2 xinhui pan 2022-12-18  521  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux