sound/soc/qcom/sc7180.c:163 sc7180_snd_startup() error: uninitialized symbol 'pll_id'.

From: Dan Carpenter
Date: Wed Jan 19 2022 - 00:13:54 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: e3a8b6a1e70c37702054ae3c7c07ed828435d8ee
commit: 425c5fce8a03c9da70a4c763cd7db22fbb422dcf ASoC: qcom: Add support for ALC5682I-VS codec
config: openrisc-randconfig-m031-20220117 (https://download.01.org/0day-ci/archive/20220118/202201181744.zq89wXU1-lkp@xxxxxxxxx/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/qcom/sc7180.c:163 sc7180_snd_startup() error: uninitialized symbol 'pll_id'.
sound/soc/qcom/sc7180.c:163 sc7180_snd_startup() error: uninitialized symbol 'pll_source'.
sound/soc/qcom/sc7180.c:164 sc7180_snd_startup() error: uninitialized symbol 'pll_in'.
sound/soc/qcom/sc7180.c:164 sc7180_snd_startup() error: uninitialized symbol 'pll_out'.
sound/soc/qcom/sc7180.c:171 sc7180_snd_startup() error: uninitialized symbol 'clk_id'.

vim +/pll_id +163 sound/soc/qcom/sc7180.c

9e3ecb5b16818a Ajit Pandey 2020-10-27 125 static int sc7180_snd_startup(struct snd_pcm_substream *substream)
9e3ecb5b16818a Ajit Pandey 2020-10-27 126 {
9e3ecb5b16818a Ajit Pandey 2020-10-27 127 struct snd_soc_pcm_runtime *rtd = substream->private_data;
9e3ecb5b16818a Ajit Pandey 2020-10-27 128 struct snd_soc_card *card = rtd->card;
9e3ecb5b16818a Ajit Pandey 2020-10-27 129 struct sc7180_snd_data *data = snd_soc_card_get_drvdata(card);
9e3ecb5b16818a Ajit Pandey 2020-10-27 130 struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
9e3ecb5b16818a Ajit Pandey 2020-10-27 131 struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
425c5fce8a03c9 lvzhaoxiong 2021-11-23 132 int pll_id, pll_source, pll_in, pll_out, clk_id, ret;
425c5fce8a03c9 lvzhaoxiong 2021-11-23 133
425c5fce8a03c9 lvzhaoxiong 2021-11-23 134 if (!(strcmp(card->name, "sc7180-rt5682-max98357a-1mic"))) {
425c5fce8a03c9 lvzhaoxiong 2021-11-23 135 pll_source = RT5682_PLL1_S_MCLK;
425c5fce8a03c9 lvzhaoxiong 2021-11-23 136 pll_id = 0;
425c5fce8a03c9 lvzhaoxiong 2021-11-23 137 clk_id = RT5682_SCLK_S_PLL1;
425c5fce8a03c9 lvzhaoxiong 2021-11-23 138 pll_out = RT5682_PLL1_FREQ;
425c5fce8a03c9 lvzhaoxiong 2021-11-23 139 pll_in = DEFAULT_MCLK_RATE;
425c5fce8a03c9 lvzhaoxiong 2021-11-23 140 } else if (!(strcmp(card->name, "sc7180-rt5682s-max98357a-1mic"))) {
425c5fce8a03c9 lvzhaoxiong 2021-11-23 141 pll_source = RT5682S_PLL_S_MCLK;
425c5fce8a03c9 lvzhaoxiong 2021-11-23 142 pll_id = RT5682S_PLL2;
425c5fce8a03c9 lvzhaoxiong 2021-11-23 143 clk_id = RT5682S_SCLK_S_PLL2;
425c5fce8a03c9 lvzhaoxiong 2021-11-23 144 pll_out = RT5682_PLL1_FREQ;
425c5fce8a03c9 lvzhaoxiong 2021-11-23 145 pll_in = DEFAULT_MCLK_RATE;
425c5fce8a03c9 lvzhaoxiong 2021-11-23 146 }

No else statement.

9e3ecb5b16818a Ajit Pandey 2020-10-27 147
9e3ecb5b16818a Ajit Pandey 2020-10-27 148 switch (cpu_dai->id) {
9e3ecb5b16818a Ajit Pandey 2020-10-27 149 case MI2S_PRIMARY:
9e3ecb5b16818a Ajit Pandey 2020-10-27 150 if (++data->pri_mi2s_clk_count == 1) {
9e3ecb5b16818a Ajit Pandey 2020-10-27 151 snd_soc_dai_set_sysclk(cpu_dai,
9e3ecb5b16818a Ajit Pandey 2020-10-27 152 LPASS_MCLK0,
9e3ecb5b16818a Ajit Pandey 2020-10-27 153 DEFAULT_MCLK_RATE,
9e3ecb5b16818a Ajit Pandey 2020-10-27 154 SNDRV_PCM_STREAM_PLAYBACK);
9e3ecb5b16818a Ajit Pandey 2020-10-27 155 }
9e3ecb5b16818a Ajit Pandey 2020-10-27 156
9e3ecb5b16818a Ajit Pandey 2020-10-27 157 snd_soc_dai_set_fmt(codec_dai,
9e3ecb5b16818a Ajit Pandey 2020-10-27 158 SND_SOC_DAIFMT_CBS_CFS |
9e3ecb5b16818a Ajit Pandey 2020-10-27 159 SND_SOC_DAIFMT_NB_NF |
9e3ecb5b16818a Ajit Pandey 2020-10-27 160 SND_SOC_DAIFMT_I2S);
9e3ecb5b16818a Ajit Pandey 2020-10-27 161
9e3ecb5b16818a Ajit Pandey 2020-10-27 162 /* Configure PLL1 for codec */
425c5fce8a03c9 lvzhaoxiong 2021-11-23 @163 ret = snd_soc_dai_set_pll(codec_dai, pll_id, pll_source,
425c5fce8a03c9 lvzhaoxiong 2021-11-23 @164 pll_in, pll_out);
9e3ecb5b16818a Ajit Pandey 2020-10-27 165 if (ret) {
9e3ecb5b16818a Ajit Pandey 2020-10-27 166 dev_err(rtd->dev, "can't set codec pll: %d\n", ret);
9e3ecb5b16818a Ajit Pandey 2020-10-27 167 return ret;
9e3ecb5b16818a Ajit Pandey 2020-10-27 168 }
9e3ecb5b16818a Ajit Pandey 2020-10-27 169
9e3ecb5b16818a Ajit Pandey 2020-10-27 170 /* Configure sysclk for codec */
425c5fce8a03c9 lvzhaoxiong 2021-11-23 @171 ret = snd_soc_dai_set_sysclk(codec_dai, clk_id, pll_out,
9e3ecb5b16818a Ajit Pandey 2020-10-27 172 SND_SOC_CLOCK_IN);
9e3ecb5b16818a Ajit Pandey 2020-10-27 173 if (ret)
9e3ecb5b16818a Ajit Pandey 2020-10-27 174 dev_err(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n",
9e3ecb5b16818a Ajit Pandey 2020-10-27 175 ret);
9e3ecb5b16818a Ajit Pandey 2020-10-27 176
9e3ecb5b16818a Ajit Pandey 2020-10-27 177 break;
9e3ecb5b16818a Ajit Pandey 2020-10-27 178 case MI2S_SECONDARY:
9e3ecb5b16818a Ajit Pandey 2020-10-27 179 break;
9e3ecb5b16818a Ajit Pandey 2020-10-27 180 case LPASS_DP_RX:
9e3ecb5b16818a Ajit Pandey 2020-10-27 181 break;
9e3ecb5b16818a Ajit Pandey 2020-10-27 182 default:
9e3ecb5b16818a Ajit Pandey 2020-10-27 183 dev_err(rtd->dev, "%s: invalid dai id 0x%x\n", __func__,
9e3ecb5b16818a Ajit Pandey 2020-10-27 184 cpu_dai->id);
9e3ecb5b16818a Ajit Pandey 2020-10-27 185 return -EINVAL;
9e3ecb5b16818a Ajit Pandey 2020-10-27 186 }
9e3ecb5b16818a Ajit Pandey 2020-10-27 187 return 0;
9e3ecb5b16818a Ajit Pandey 2020-10-27 188 }

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