[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

Dan Murphy dmurphy at ti.com
Fri Oct 11 14:13:38 CEST 2019


Mark

On 10/10/19 11:41 AM, kbuild test robot wrote:
> 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)

The only fix I can see here is to change bitwidth to snd_pcm_format_t as 
opposed to an integer.

But that still gives this sparse warning.  The way the code below is 
written  to be consistent throughout the drivers so are these warnings 
false positives?

I get similar ones for the tas2770 as well

Dan


>     191	{
>     192		int ret;
>     193	
>     194		switch (bitwidth) {
>   > 195		case SNDRV_PCM_FORMAT_S16_LE:
> <snip>


More information about the Alsa-devel mailing list