Re: [PATCH V2 2/2] ASoC: max98396: add amplifier driver

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

 



Hi Ryan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on broonie-sound/for-next]
[also build test WARNING on v5.18-rc3 next-20220421]
[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/intel-lab-lkp/linux/commits/Ryan-Lee/ASoC-dt-bindings-max98396-add-amplifier-driver/20220422-070610
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: arm-buildonly-randconfig-r003-20220421 (https://download.01.org/0day-ci/archive/20220422/202204221550.phNeKLyn-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 5bd87350a5ae429baf8f373cb226a57b62f87280)
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 arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://github.com/intel-lab-lkp/linux/commit/1acb9ac9acbd834a2e93c2127be6bdd1716dc6dd
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Ryan-Lee/ASoC-dt-bindings-max98396-add-amplifier-driver/20220422-070610
        git checkout 1acb9ac9acbd834a2e93c2127be6bdd1716dc6dd
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm 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/max98396.c:408:7: warning: variable 'update' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
                   if (format != (reg & MAX98396_PCM_MODE_CFG_FORMAT_MASK))
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/soc/codecs/max98396.c:411:7: note: uninitialized use occurs here
                   if (update)
                       ^~~~~~
   sound/soc/codecs/max98396.c:408:3: note: remove the 'if' if its condition is always true
                   if (format != (reg & MAX98396_PCM_MODE_CFG_FORMAT_MASK))
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/soc/codecs/max98396.c:349:13: note: initialize the variable 'update' to silence this warning
           bool update;
                      ^
                       = 0
   1 warning generated.


vim +408 sound/soc/codecs/max98396.c

   339	
   340	static int max98396_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
   341	{
   342		struct snd_soc_component *component = codec_dai->component;
   343		struct max98396_priv *max98396 = snd_soc_component_get_drvdata(component);
   344		unsigned int format;
   345		unsigned int bclk_pol = 0;
   346		unsigned int fsync_pol = 0;
   347		int ret, status;
   348		int reg;
   349		bool update;
   350	
   351		dev_dbg(component->dev, "%s: fmt 0x%08X\n", __func__, fmt);
   352	
   353		switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
   354		case SND_SOC_DAIFMT_NB_NF:
   355			break;
   356		case SND_SOC_DAIFMT_NB_IF:
   357			fsync_pol = MAX98396_PCM_MODE_CFG_PCM_LRCLKEDGE;
   358			break;
   359		case SND_SOC_DAIFMT_IB_NF:
   360			bclk_pol = MAX98396_PCM_MODE_CFG_PCM_BCLKEDGE;
   361			break;
   362		case SND_SOC_DAIFMT_IB_IF:
   363			bclk_pol = MAX98396_PCM_MODE_CFG_PCM_BCLKEDGE;
   364			fsync_pol = MAX98396_PCM_MODE_CFG_PCM_LRCLKEDGE;
   365			break;
   366	
   367		default:
   368			dev_err(component->dev, "DAI invert mode unsupported\n");
   369			return -EINVAL;
   370		}
   371	
   372		regmap_update_bits(max98396->regmap,
   373				   MAX98396_R2041_PCM_MODE_CFG,
   374				   MAX98396_PCM_MODE_CFG_PCM_LRCLKEDGE,
   375				   fsync_pol);
   376	
   377		regmap_update_bits(max98396->regmap,
   378				   MAX98396_R2042_PCM_CLK_SETUP,
   379				   MAX98396_PCM_MODE_CFG_PCM_BCLKEDGE,
   380				   bclk_pol);
   381	
   382		/* interface format */
   383		switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
   384		case SND_SOC_DAIFMT_I2S:
   385			format = MAX98396_PCM_FORMAT_I2S;
   386			break;
   387		case SND_SOC_DAIFMT_LEFT_J:
   388			format = MAX98396_PCM_FORMAT_LJ;
   389			break;
   390		case SND_SOC_DAIFMT_DSP_A:
   391			format = MAX98396_PCM_FORMAT_TDM_MODE1;
   392			break;
   393		case SND_SOC_DAIFMT_DSP_B:
   394			format = MAX98396_PCM_FORMAT_TDM_MODE0;
   395			break;
   396		default:
   397			return -EINVAL;
   398		}
   399	
   400		ret = regmap_read(max98396->regmap, MAX98396_R210F_GLOBAL_EN, &status);
   401		if (ret < 0)
   402			return -EINVAL;
   403	
   404		if (status) {
   405			ret = regmap_read(max98396->regmap, MAX98396_R2041_PCM_MODE_CFG, &reg);
   406			if (ret < 0)
   407				return -EINVAL;
 > 408			if (format != (reg & MAX98396_PCM_MODE_CFG_FORMAT_MASK))
   409				update = true;
   410			/* GLOBAL_EN OFF prior to pcm mode change */
   411			if (update)
   412				max98396_global_enable_onoff(max98396->regmap, false);
   413		}
   414	
   415		regmap_update_bits(max98396->regmap,
   416				   MAX98396_R2041_PCM_MODE_CFG,
   417				   MAX98396_PCM_MODE_CFG_FORMAT_MASK,
   418				   format);
   419	
   420		if (status && update)
   421			max98396_global_enable_onoff(max98396->regmap, true);
   422	
   423		return 0;
   424	}
   425	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp



[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