sound/soc/codecs/tas5754m.c:246:7: warning: variable 'ret' is used uninitialized whenever switch case is taken

From: kernel test robot
Date: Wed Jan 19 2022 - 14:03:05 EST


tree: https://github.com/0day-ci/linux/commits/UPDATE-20220119-210919/Joerg-Schambacher/ASoC-adds-component-driver-for-TAS575xM-digital-amplifiers/20220110-164852
head: 05b8bf5544bc621031f5a0a6bdf1ac6468a7367b
commit: 05b8bf5544bc621031f5a0a6bdf1ac6468a7367b ASoC: adds component driver for TAS575xM digital amplifiers
date: 5 hours ago
config: riscv-randconfig-c006-20220118 (https://download.01.org/0day-ci/archive/20220120/202201200259.nNgbKOJd-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project f7b7138a62648f4019c55e4671682af1f851f295)
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/05b8bf5544bc621031f5a0a6bdf1ac6468a7367b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review UPDATE-20220119-210919/Joerg-Schambacher/ASoC-adds-component-driver-for-TAS575xM-digital-amplifiers/20220110-164852
git checkout 05b8bf5544bc621031f5a0a6bdf1ac6468a7367b
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash sound/soc/codecs/

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/tas5754m.c:246:7: warning: variable 'ret' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
case SND_SOC_BIAS_ON:
^~~~~~~~~~~~~~~
sound/soc/codecs/tas5754m.c:267:9: note: uninitialized use occurs here
return ret;
^~~
sound/soc/codecs/tas5754m.c:247:7: warning: variable 'ret' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
case SND_SOC_BIAS_PREPARE:
^~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/tas5754m.c:267:9: note: uninitialized use occurs here
return ret;
^~~
sound/soc/codecs/tas5754m.c:242:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
2 warnings generated.


vim +/ret +246 sound/soc/codecs/tas5754m.c

236
237 static int tas5754m_set_bias_level(struct snd_soc_component *component,
238 enum snd_soc_bias_level level)
239 {
240 struct tas5754m_priv *tas5754m =
241 snd_soc_component_get_drvdata(component);
242 int ret;
243
244 switch (level) {
245 default:
> 246 case SND_SOC_BIAS_ON:
247 case SND_SOC_BIAS_PREPARE:
248 break;
249
250 case SND_SOC_BIAS_STANDBY:
251 ret = regmap_update_bits(tas5754m->regmap,
252 TAS5754M_POWER, TAS5754M_RQST, 0);
253 if (ret)
254 dev_err(component->dev,
255 "Failed to remove standby: %d\n", ret);
256 break;
257
258 case SND_SOC_BIAS_OFF:
259 ret = regmap_update_bits(tas5754m->regmap,
260 TAS5754M_POWER, TAS5754M_RQST, TAS5754M_RQST);
261 if (ret)
262 dev_err(component->dev,
263 "Failed to request standby: %d\n", ret);
264 break;
265 }
266
267 return ret;
268 }
269

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