Alsa-Devel Archive on lore.kernel.org
 help / color / Atom feed
* [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
@ 2019-10-10 16:41 kbuild test robot
  2019-10-11 12:13 ` Dan Murphy
  0 siblings, 1 reply; 2+ messages in thread
From: kbuild test robot @ 2019-10-10 16:41 UTC (permalink / raw)
  To: Dan Murphy; +Cc: alsa-devel, Mark Brown, kbuild-all

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@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
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [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
  2019-10-10 16:41 [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
@ 2019-10-11 12:13 ` Dan Murphy
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Murphy @ 2019-10-11 12:13 UTC (permalink / raw)
  To: kbuild test robot; +Cc: alsa-devel, Mark Brown, kbuild-all

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@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>
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-10 16:41 [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
2019-10-11 12:13 ` Dan Murphy

Alsa-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/alsa-devel/0 alsa-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 alsa-devel alsa-devel/ https://lore.kernel.org/alsa-devel \
		alsa-devel@alsa-project.org alsa-devel@archiver.kernel.org
	public-inbox-index alsa-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.alsa-project.alsa-devel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox