[alsa-devel] [asoc:for-5.5 122/122] sound/soc/codecs/tas2562.c:195:14: sparse: sparse: restricted snd_pcm_format_t degrades to integer

kbuild test robot lkp at intel.com
Thu Oct 10 18:41:19 CEST 2019


tree:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.5
head:   c173dba44c2d2ec2adaa4e607e9729b74236bd57
commit: c173dba44c2d2ec2adaa4e607e9729b74236bd57 [122/122] ASoC: tas2562: Introduce the TAS2562 amplifier
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-rc1-42-g38eda53-dirty
        git checkout c173dba44c2d2ec2adaa4e607e9729b74236bd57
        make ARCH=x86_64 allmodconfig
        make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>


sparse warnings: (new ones prefixed by >>)

>> sound/soc/codecs/tas2562.c:195:14: sparse: sparse: restricted snd_pcm_format_t degrades to integer
   sound/soc/codecs/tas2562.c:202:14: sparse: sparse: restricted snd_pcm_format_t degrades to integer
   sound/soc/codecs/tas2562.c:209:14: sparse: sparse: restricted snd_pcm_format_t degrades to integer
>> sound/soc/codecs/tas2562.c:246:58: sparse: sparse: incorrect type in argument 2 (different base types) @@    expected int bitwidth @@    got restricted snd_pcm_formint bitwidth @@
>> sound/soc/codecs/tas2562.c:246:58: sparse:    expected int bitwidth
>> sound/soc/codecs/tas2562.c:246:58: sparse:    got restricted snd_pcm_format_t
   sound/soc/codecs/tas2562.c:472:39: sparse: sparse: restricted snd_pcm_format_t degrades to integer

vim +195 sound/soc/codecs/tas2562.c

   189	
   190	static int tas2562_set_bitwidth(struct tas2562_data *tas2562, int bitwidth)
   191	{
   192		int ret;
   193	
   194		switch (bitwidth) {
 > 195		case SNDRV_PCM_FORMAT_S16_LE:
   196			snd_soc_component_update_bits(tas2562->component,
   197						      TAS2562_TDM_CFG2,
   198						      TAS2562_TDM_CFG2_RXWLEN_MASK,
   199						      TAS2562_TDM_CFG2_RXWLEN_16B);
   200			tas2562->v_sense_slot = tas2562->i_sense_slot + 2;
   201			break;
   202		case SNDRV_PCM_FORMAT_S24_LE:
   203			snd_soc_component_update_bits(tas2562->component,
   204						      TAS2562_TDM_CFG2,
   205						      TAS2562_TDM_CFG2_RXWLEN_MASK,
   206						      TAS2562_TDM_CFG2_RXWLEN_24B);
   207			tas2562->v_sense_slot = tas2562->i_sense_slot + 4;
   208			break;
   209		case SNDRV_PCM_FORMAT_S32_LE:
   210			snd_soc_component_update_bits(tas2562->component,
   211						      TAS2562_TDM_CFG2,
   212						      TAS2562_TDM_CFG2_RXWLEN_MASK,
   213						      TAS2562_TDM_CFG2_RXWLEN_32B);
   214			tas2562->v_sense_slot = tas2562->i_sense_slot + 4;
   215			break;
   216	
   217		default:
   218			dev_info(tas2562->dev, "Not supported params format\n");
   219		}
   220	
   221		ret = snd_soc_component_update_bits(tas2562->component,
   222			TAS2562_TDM_CFG5,
   223			TAS2562_TDM_CFG5_VSNS_EN | TAS2562_TDM_CFG5_VSNS_SLOT_MASK,
   224			TAS2562_TDM_CFG5_VSNS_EN | tas2562->v_sense_slot);
   225		if (ret < 0)
   226			return ret;
   227	
   228		ret = snd_soc_component_update_bits(tas2562->component,
   229			TAS2562_TDM_CFG6,
   230			TAS2562_TDM_CFG6_ISNS_EN | TAS2562_TDM_CFG6_ISNS_SLOT_MASK,
   231			TAS2562_TDM_CFG6_ISNS_EN | tas2562->i_sense_slot);
   232		if (ret < 0)
   233			return ret;
   234	
   235		return 0;
   236	}
   237	
   238	static int tas2562_hw_params(struct snd_pcm_substream *substream,
   239				     struct snd_pcm_hw_params *params,
   240				     struct snd_soc_dai *dai)
   241	{
   242		struct snd_soc_component *component = dai->component;
   243		struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component);
   244		int ret;
   245	
 > 246		ret = tas2562_set_bitwidth(tas2562, params_format(params));
   247		if (ret) {
   248			dev_err(tas2562->dev, "set bitwidth failed, %d\n", ret);
   249			return ret;
   250		}
   251	
   252		ret = tas2562_set_samplerate(tas2562, params_rate(params));
   253		if (ret)
   254			dev_err(tas2562->dev, "set bitwidth failed, %d\n", ret);
   255	
   256		return ret;
   257	}
   258	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation


More information about the Alsa-devel mailing list