[tiwai-sound:for-next 49/52] sound/pci/hda/tas2781_hda_spi.c:110:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
head:   dd85bbb7fc482b5cdb78f8b5e8f9ef7a3919d6ef
commit: bb5f86ea50ffb292f42eb1ebdb99991d5c5ac3ba [49/52] ALSA: hda/tas2781: Add tas2781 hda SPI driver
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20250119/202501192006.Hm9GmKiV-lkp@xxxxxxxxx/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250119/202501192006.Hm9GmKiV-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/202501192006.Hm9GmKiV-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> sound/pci/hda/tas2781_hda_spi.c:110:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
     110 |         if (tas_priv->cur_book != TASDEVICE_BOOK_ID(reg)) {
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/pci/hda/tas2781_hda_spi.c:119:9: note: uninitialized use occurs here
     119 |         return ret;
         |                ^~~
   sound/pci/hda/tas2781_hda_spi.c:110:2: note: remove the 'if' if its condition is always true
     110 |         if (tas_priv->cur_book != TASDEVICE_BOOK_ID(reg)) {
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/pci/hda/tas2781_hda_spi.c:108:9: note: initialize the variable 'ret' to silence this warning
     108 |         int ret;
         |                ^
         |                 = 0
   1 warning generated.


vim +110 sound/pci/hda/tas2781_hda_spi.c

   104	
   105	static int tasdevice_spi_switch_book(struct tasdevice_priv *tas_priv, int reg)
   106	{
   107		struct regmap *map = tas_priv->regmap;
   108		int ret;
   109	
 > 110		if (tas_priv->cur_book != TASDEVICE_BOOK_ID(reg)) {
   111			ret = regmap_write(map, TASDEVICE_BOOKCTL_REG,
   112					   TASDEVICE_BOOK_ID(reg));
   113			if (ret < 0) {
   114				dev_err(tas_priv->dev, "Switch Book E=%d\n", ret);
   115				return ret;
   116			}
   117			tas_priv->cur_book = TASDEVICE_BOOK_ID(reg);
   118		}
   119		return ret;
   120	}
   121	

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



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux