[alsa-devel] [asoc:topic/stm32 5/7] sound/soc/stm/stm32_sai_sub.c:467:7: warning: 'cr1' may be used uninitialized in this function

kbuild test robot fengguang.wu at intel.com
Sat Oct 21 13:04:25 CEST 2017


tree:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git topic/stm32
head:   5914d285f6b782892a91d6621723fdc41a775b15
commit: 61fb4ff70377cd2c49a3487bdb0156eba6930072 [5/7] ASoC: stm32: sai: Move static settings to DAI init
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 61fb4ff70377cd2c49a3487bdb0156eba6930072
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   sound/soc/stm/stm32_sai_sub.c: In function 'stm32_sai_hw_params':
>> sound/soc/stm/stm32_sai_sub.c:467:7: warning: 'cr1' may be used uninitialized in this function [-Wmaybe-uninitialized]
      cr1 |= SAI_XCR1_DS_SET(SAI_DATASIZE_8);
          ^
   sound/soc/stm/stm32_sai_sub.c:451:6: note: 'cr1' was declared here
     int cr1, cr1_mask, ret;
         ^

vim +/cr1 +467 sound/soc/stm/stm32_sai_sub.c

3e086edf olivier moysan 2017-04-10  445  
3e086edf olivier moysan 2017-04-10  446  static int stm32_sai_set_config(struct snd_soc_dai *cpu_dai,
3e086edf olivier moysan 2017-04-10  447  				struct snd_pcm_substream *substream,
3e086edf olivier moysan 2017-04-10  448  				struct snd_pcm_hw_params *params)
3e086edf olivier moysan 2017-04-10  449  {
3e086edf olivier moysan 2017-04-10  450  	struct stm32_sai_sub_data *sai = snd_soc_dai_get_drvdata(cpu_dai);
3e086edf olivier moysan 2017-04-10  451  	int cr1, cr1_mask, ret;
3e086edf olivier moysan 2017-04-10  452  
a4529d2b Olivier Moysan 2017-10-19  453  	/*
a4529d2b Olivier Moysan 2017-10-19  454  	 * DMA bursts increment is set to 4 words.
a4529d2b Olivier Moysan 2017-10-19  455  	 * SAI fifo threshold is set to half fifo, to keep enough space
a4529d2b Olivier Moysan 2017-10-19  456  	 * for DMA incoming bursts.
a4529d2b Olivier Moysan 2017-10-19  457  	 */
3e086edf olivier moysan 2017-04-10  458  	regmap_update_bits(sai->regmap, STM_SAI_CR2_REGX,
3e086edf olivier moysan 2017-04-10  459  			   SAI_XCR2_FFLUSH | SAI_XCR2_FTH_MASK,
a4529d2b Olivier Moysan 2017-10-19  460  			   SAI_XCR2_FFLUSH |
a4529d2b Olivier Moysan 2017-10-19  461  			   SAI_XCR2_FTH_SET(STM_SAI_FIFO_TH_HALF));
3e086edf olivier moysan 2017-04-10  462  
3e086edf olivier moysan 2017-04-10  463  	/* Mode, data format and channel config */
61fb4ff7 Olivier Moysan 2017-10-19  464  	cr1_mask = SAI_XCR1_DS_MASK;
3e086edf olivier moysan 2017-04-10  465  	switch (params_format(params)) {
3e086edf olivier moysan 2017-04-10  466  	case SNDRV_PCM_FORMAT_S8:
3e086edf olivier moysan 2017-04-10 @467  		cr1 |= SAI_XCR1_DS_SET(SAI_DATASIZE_8);
3e086edf olivier moysan 2017-04-10  468  		break;
3e086edf olivier moysan 2017-04-10  469  	case SNDRV_PCM_FORMAT_S16_LE:
3e086edf olivier moysan 2017-04-10  470  		cr1 |= SAI_XCR1_DS_SET(SAI_DATASIZE_16);
3e086edf olivier moysan 2017-04-10  471  		break;
3e086edf olivier moysan 2017-04-10  472  	case SNDRV_PCM_FORMAT_S32_LE:
3e086edf olivier moysan 2017-04-10  473  		cr1 |= SAI_XCR1_DS_SET(SAI_DATASIZE_32);
3e086edf olivier moysan 2017-04-10  474  		break;
3e086edf olivier moysan 2017-04-10  475  	default:
3e086edf olivier moysan 2017-04-10  476  		dev_err(cpu_dai->dev, "Data format not supported");
3e086edf olivier moysan 2017-04-10  477  		return -EINVAL;
3e086edf olivier moysan 2017-04-10  478  	}
3e086edf olivier moysan 2017-04-10  479  
3e086edf olivier moysan 2017-04-10  480  	cr1_mask |= SAI_XCR1_MONO;
3e086edf olivier moysan 2017-04-10  481  	if ((sai->slots == 2) && (params_channels(params) == 1))
3e086edf olivier moysan 2017-04-10  482  		cr1 |= SAI_XCR1_MONO;
3e086edf olivier moysan 2017-04-10  483  
3e086edf olivier moysan 2017-04-10  484  	ret = regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, cr1_mask, cr1);
3e086edf olivier moysan 2017-04-10  485  	if (ret < 0) {
3e086edf olivier moysan 2017-04-10  486  		dev_err(cpu_dai->dev, "Failed to update CR1 register\n");
3e086edf olivier moysan 2017-04-10  487  		return ret;
3e086edf olivier moysan 2017-04-10  488  	}
3e086edf olivier moysan 2017-04-10  489  
3e086edf olivier moysan 2017-04-10  490  	return 0;
3e086edf olivier moysan 2017-04-10  491  }
3e086edf olivier moysan 2017-04-10  492  

:::::: The code at line 467 was first introduced by commit
:::::: 3e086edfe0c73daaabd929b926bbe26536272d9a ASoC: stm32: add SAI driver

:::::: TO: olivier moysan <olivier.moysan at st.com>
:::::: CC: Mark Brown <broonie at kernel.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 51721 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20171021/a1935094/attachment-0001.bin>


More information about the Alsa-devel mailing list