Re: [PATCH] ASoC: nau8821: Add driver for Nuvoton codec NAU88L21

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

 



Hi Seven,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on asoc/for-next]
[also build test WARNING on v5.14-rc7 next-20210823]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Seven-Lee/ASoC-nau8821-Add-driver-for-Nuvoton-codec-NAU88L21/20210824-121846
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: riscv-randconfig-r014-20210824 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d26000e4cc2bc65e207a84fa26cb6e374d60aa12)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/0day-ci/linux/commit/429cd8c43255317cb7b67d614f90d3ddd58ef401
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Seven-Lee/ASoC-nau8821-Add-driver-for-Nuvoton-codec-NAU88L21/20210824-121846
        git checkout 429cd8c43255317cb7b67d614f90d3ddd58ef401
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> sound/soc/codecs/nau8821.c:442:15: warning: variable 'speed_selection' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
           for (i = 0 ; i < 4 ; i++) {
                        ^~~~~
   sound/soc/codecs/nau8821.c:456:4: note: uninitialized use occurs here
                   (speed_selection << NAU8821_DMIC_SRC_SFT));
                    ^~~~~~~~~~~~~~~
   sound/soc/codecs/nau8821.c:442:15: note: remove the condition if it is always true
           for (i = 0 ; i < 4 ; i++) {
                        ^~~~~~
   sound/soc/codecs/nau8821.c:429:24: note: initialize the variable 'speed_selection' to silence this warning
           int i, speed_selection, clk_adc_src, clk_adc;
                                 ^
                                  = 0
   1 warning generated.


vim +442 sound/soc/codecs/nau8821.c

   418	
   419	static const struct snd_kcontrol_new nau8821_adc_ch0_dmic =
   420		SOC_DAPM_SINGLE("Switch", NAU8821_R13_DMIC_CTRL,
   421			NAU8821_DMIC_EN_SFT, 1, 0);
   422	
   423	static int dmic_clock_control(struct snd_soc_dapm_widget *w,
   424			struct snd_kcontrol *k, int  event)
   425	{
   426		struct snd_soc_component *component =
   427			snd_soc_dapm_to_component(w->dapm);
   428		struct nau8821 *nau8821 = snd_soc_component_get_drvdata(component);
   429		int i, speed_selection, clk_adc_src, clk_adc;
   430		unsigned int clk_divider_r03;
   431	
   432		/* The DMIC clock is gotten from adc clock divided by
   433		 * CLK_DMIC_SRC (1, 2, 4, 8). The clock has to be equal or
   434		 * less than nau8821->dmic_clk_threshold.
   435		 */
   436		regmap_read(nau8821->regmap, NAU8821_R03_CLK_DIVIDER,
   437			&clk_divider_r03);
   438		clk_adc_src = (clk_divider_r03 & NAU8821_CLK_ADC_SRC_MASK)
   439			>> NAU8821_CLK_ADC_SRC_SFT;
   440		clk_adc = (nau8821->fs * 256) >> clk_adc_src;
   441	
 > 442		for (i = 0 ; i < 4 ; i++) {
   443			if ((clk_adc >> dmic_speed_sel[i].param) <=
   444				nau8821->dmic_clk_threshold) {
   445				speed_selection = dmic_speed_sel[i].val;
   446				break;
   447			}
   448		}
   449	
   450		dev_dbg(nau8821->dev,
   451			"clk_adc=%d, dmic_clk_threshold = %d, param=%d, val = %d\n",
   452			clk_adc, nau8821->dmic_clk_threshold,
   453			dmic_speed_sel[i].param, dmic_speed_sel[i].val);
   454		regmap_update_bits(nau8821->regmap, NAU8821_R13_DMIC_CTRL,
   455			NAU8821_DMIC_SRC_MASK,
   456			(speed_selection << NAU8821_DMIC_SRC_SFT));
   457	
   458		return 0;
   459	}
   460	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[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