[efi:next 6/9] drivers/firmware/efi/libstub/gop.c:283:7: warning: variable 'depth' is used uninitialized whenever switch case is taken

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git next
head:   159ec6de007d8a2791bdba850ec4dbe83272561c
commit: 5169cdfff5af8a40f4152d19d7fd70320567f2e6 [6/9] efi/libstub: Refactor and clean up GOP resolution picker code
config: riscv-randconfig-001-20250107 (https://download.01.org/0day-ci/archive/20250107/202501070836.Xd7wJiOd-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250107/202501070836.Xd7wJiOd-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501070836.Xd7wJiOd-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/firmware/efi/libstub/gop.c:283:7: warning: variable 'depth' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
           case PIXEL_BLT_ONLY:
                ^~~~~~~~~~~~~~
   drivers/firmware/efi/libstub/efistub.h:522:28: note: expanded from macro 'PIXEL_BLT_ONLY'
   #define PIXEL_BLT_ONLY                                  3
                                                           ^
   drivers/firmware/efi/libstub/gop.c:297:13: note: uninitialized use occurs here
                       dstr, depth);
                             ^~~~~
   drivers/firmware/efi/libstub/gop.c:276:7: warning: variable 'depth' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
           case PIXEL_BGR_RESERVED_8BIT_PER_COLOR:
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/firmware/efi/libstub/efistub.h:520:44: note: expanded from macro 'PIXEL_BGR_RESERVED_8BIT_PER_COLOR'
   #define PIXEL_BGR_RESERVED_8BIT_PER_COLOR               1
                                                           ^
   drivers/firmware/efi/libstub/gop.c:297:13: note: uninitialized use occurs here
                       dstr, depth);
                             ^~~~~
   drivers/firmware/efi/libstub/gop.c:273:7: warning: variable 'depth' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
           case PIXEL_RGB_RESERVED_8BIT_PER_COLOR:
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/firmware/efi/libstub/efistub.h:519:44: note: expanded from macro 'PIXEL_RGB_RESERVED_8BIT_PER_COLOR'
   #define PIXEL_RGB_RESERVED_8BIT_PER_COLOR               0
                                                           ^
   drivers/firmware/efi/libstub/gop.c:297:13: note: uninitialized use occurs here
                       dstr, depth);
                             ^~~~~
>> drivers/firmware/efi/libstub/gop.c:286:2: warning: variable 'depth' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
           default:
           ^~~~~~~
   drivers/firmware/efi/libstub/gop.c:297:13: note: uninitialized use occurs here
                       dstr, depth);
                             ^~~~~
   drivers/firmware/efi/libstub/gop.c:268:10: note: initialize the variable 'depth' to silence this warning
           u8 depth;
                   ^
                    = '\0'
   4 warnings generated.


vim +/depth +283 drivers/firmware/efi/libstub/gop.c

45d97a749e9fec Arvind Sankar  2020-03-28  260  
5169cdfff5af8a Ard Biesheuvel 2024-12-20  261  static bool match_list(const efi_graphics_output_mode_info_t *info, u32 mode, void *ctx)
14c574f35cfbc9 Arvind Sankar  2020-05-18  262  {
5169cdfff5af8a Ard Biesheuvel 2024-12-20  263  	efi_pixel_bitmask_t pi = info->pixel_information;
5169cdfff5af8a Ard Biesheuvel 2024-12-20  264  	u32 cur_mode = (unsigned long)ctx;
5169cdfff5af8a Ard Biesheuvel 2024-12-20  265  	int pf = info->pixel_format;
14c574f35cfbc9 Arvind Sankar  2020-05-18  266  	const char *dstr;
14c574f35cfbc9 Arvind Sankar  2020-05-18  267  	bool valid;
5169cdfff5af8a Ard Biesheuvel 2024-12-20  268  	u8 depth;
14c574f35cfbc9 Arvind Sankar  2020-05-18  269  
14c574f35cfbc9 Arvind Sankar  2020-05-18  270  	valid = !(pf == PIXEL_BLT_ONLY || pf >= PIXEL_FORMAT_MAX);
5169cdfff5af8a Ard Biesheuvel 2024-12-20  271  
14c574f35cfbc9 Arvind Sankar  2020-05-18  272  	switch (pf) {
14c574f35cfbc9 Arvind Sankar  2020-05-18  273  	case PIXEL_RGB_RESERVED_8BIT_PER_COLOR:
14c574f35cfbc9 Arvind Sankar  2020-05-18  274  		dstr = "rgb";
14c574f35cfbc9 Arvind Sankar  2020-05-18  275  		break;
14c574f35cfbc9 Arvind Sankar  2020-05-18  276  	case PIXEL_BGR_RESERVED_8BIT_PER_COLOR:
14c574f35cfbc9 Arvind Sankar  2020-05-18  277  		dstr = "bgr";
14c574f35cfbc9 Arvind Sankar  2020-05-18  278  		break;
14c574f35cfbc9 Arvind Sankar  2020-05-18  279  	case PIXEL_BIT_MASK:
14c574f35cfbc9 Arvind Sankar  2020-05-18  280  		dstr = "";
5169cdfff5af8a Ard Biesheuvel 2024-12-20  281  		depth = pixel_bpp(pf, pi);
14c574f35cfbc9 Arvind Sankar  2020-05-18  282  		break;
14c574f35cfbc9 Arvind Sankar  2020-05-18 @283  	case PIXEL_BLT_ONLY:
14c574f35cfbc9 Arvind Sankar  2020-05-18  284  		dstr = "blt";
14c574f35cfbc9 Arvind Sankar  2020-05-18  285  		break;
14c574f35cfbc9 Arvind Sankar  2020-05-18 @286  	default:
14c574f35cfbc9 Arvind Sankar  2020-05-18  287  		dstr = "xxx";
14c574f35cfbc9 Arvind Sankar  2020-05-18  288  		break;
14c574f35cfbc9 Arvind Sankar  2020-05-18  289  	}
14c574f35cfbc9 Arvind Sankar  2020-05-18  290  
14c574f35cfbc9 Arvind Sankar  2020-05-18  291  	efi_printk("Mode %3u %c%c: Resolution %ux%u-%s%.0hhu\n",
5169cdfff5af8a Ard Biesheuvel 2024-12-20  292  		    mode,
5169cdfff5af8a Ard Biesheuvel 2024-12-20  293  		    (mode == cur_mode) ? '*' : ' ',
14c574f35cfbc9 Arvind Sankar  2020-05-18  294  		    !valid ? '-' : ' ',
5169cdfff5af8a Ard Biesheuvel 2024-12-20  295  		    info->horizontal_resolution,
5169cdfff5af8a Ard Biesheuvel 2024-12-20  296  		    info->vertical_resolution,
5169cdfff5af8a Ard Biesheuvel 2024-12-20  297  		    dstr, depth);
5169cdfff5af8a Ard Biesheuvel 2024-12-20  298  
5169cdfff5af8a Ard Biesheuvel 2024-12-20  299  	return false;
14c574f35cfbc9 Arvind Sankar  2020-05-18  300  }
14c574f35cfbc9 Arvind Sankar  2020-05-18  301  

:::::: The code at line 283 was first introduced by commit
:::::: 14c574f35cfbc9272fc67b41f074c847db139652 efi/gop: Add an option to list out the available GOP modes

:::::: TO: Arvind Sankar <nivedita@xxxxxxxxxxxx>
:::::: CC: Ard Biesheuvel <ardb@xxxxxxxxxx>

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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux