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

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

 



Hi Seven,

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: openrisc-randconfig-m031-20210824 (attached as .config)
compiler: or1k-linux-gcc (GCC) 11.2.0

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

smatch warnings:
sound/soc/codecs/nau8821.c:456 dmic_clock_control() error: uninitialized symbol 'speed_selection'.

vim +/speed_selection +456 sound/soc/codecs/nau8821.c

429cd8c43255317 Seven Lee 2021-08-24  419  static const struct snd_kcontrol_new nau8821_adc_ch0_dmic =
429cd8c43255317 Seven Lee 2021-08-24  420  	SOC_DAPM_SINGLE("Switch", NAU8821_R13_DMIC_CTRL,
429cd8c43255317 Seven Lee 2021-08-24  421  		NAU8821_DMIC_EN_SFT, 1, 0);
429cd8c43255317 Seven Lee 2021-08-24  422  
429cd8c43255317 Seven Lee 2021-08-24  423  static int dmic_clock_control(struct snd_soc_dapm_widget *w,
429cd8c43255317 Seven Lee 2021-08-24  424  		struct snd_kcontrol *k, int  event)
429cd8c43255317 Seven Lee 2021-08-24  425  {
429cd8c43255317 Seven Lee 2021-08-24  426  	struct snd_soc_component *component =
429cd8c43255317 Seven Lee 2021-08-24  427  		snd_soc_dapm_to_component(w->dapm);
429cd8c43255317 Seven Lee 2021-08-24  428  	struct nau8821 *nau8821 = snd_soc_component_get_drvdata(component);
429cd8c43255317 Seven Lee 2021-08-24  429  	int i, speed_selection, clk_adc_src, clk_adc;
429cd8c43255317 Seven Lee 2021-08-24  430  	unsigned int clk_divider_r03;
429cd8c43255317 Seven Lee 2021-08-24  431  
429cd8c43255317 Seven Lee 2021-08-24  432  	/* The DMIC clock is gotten from adc clock divided by
429cd8c43255317 Seven Lee 2021-08-24  433  	 * CLK_DMIC_SRC (1, 2, 4, 8). The clock has to be equal or
429cd8c43255317 Seven Lee 2021-08-24  434  	 * less than nau8821->dmic_clk_threshold.
429cd8c43255317 Seven Lee 2021-08-24  435  	 */
429cd8c43255317 Seven Lee 2021-08-24  436  	regmap_read(nau8821->regmap, NAU8821_R03_CLK_DIVIDER,
429cd8c43255317 Seven Lee 2021-08-24  437  		&clk_divider_r03);
429cd8c43255317 Seven Lee 2021-08-24  438  	clk_adc_src = (clk_divider_r03 & NAU8821_CLK_ADC_SRC_MASK)
429cd8c43255317 Seven Lee 2021-08-24  439  		>> NAU8821_CLK_ADC_SRC_SFT;
429cd8c43255317 Seven Lee 2021-08-24  440  	clk_adc = (nau8821->fs * 256) >> clk_adc_src;
429cd8c43255317 Seven Lee 2021-08-24  441  
429cd8c43255317 Seven Lee 2021-08-24  442  	for (i = 0 ; i < 4 ; i++) {
429cd8c43255317 Seven Lee 2021-08-24  443  		if ((clk_adc >> dmic_speed_sel[i].param) <=
429cd8c43255317 Seven Lee 2021-08-24  444  			nau8821->dmic_clk_threshold) {
429cd8c43255317 Seven Lee 2021-08-24  445  			speed_selection = dmic_speed_sel[i].val;
429cd8c43255317 Seven Lee 2021-08-24  446  			break;
429cd8c43255317 Seven Lee 2021-08-24  447  		}
429cd8c43255317 Seven Lee 2021-08-24  448  	}

speed_selection is not initialized if it exits the loop with i == 4.

429cd8c43255317 Seven Lee 2021-08-24  449  
429cd8c43255317 Seven Lee 2021-08-24  450  	dev_dbg(nau8821->dev,
429cd8c43255317 Seven Lee 2021-08-24  451  		"clk_adc=%d, dmic_clk_threshold = %d, param=%d, val = %d\n",
429cd8c43255317 Seven Lee 2021-08-24  452  		clk_adc, nau8821->dmic_clk_threshold,
429cd8c43255317 Seven Lee 2021-08-24  453  		dmic_speed_sel[i].param, dmic_speed_sel[i].val);
429cd8c43255317 Seven Lee 2021-08-24  454  	regmap_update_bits(nau8821->regmap, NAU8821_R13_DMIC_CTRL,
429cd8c43255317 Seven Lee 2021-08-24  455  		NAU8821_DMIC_SRC_MASK,
429cd8c43255317 Seven Lee 2021-08-24 @456  		(speed_selection << NAU8821_DMIC_SRC_SFT));
429cd8c43255317 Seven Lee 2021-08-24  457  
429cd8c43255317 Seven Lee 2021-08-24  458  	return 0;
429cd8c43255317 Seven Lee 2021-08-24  459  }

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




[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