sound/soc/tegra/tegra210_adx.c:125:14: sparse: sparse: restricted snd_pcm_format_t degrades to integer

From: kernel test robot
Date: Fri Nov 26 2021 - 14:46:25 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 1bff7d7e8c487b9b0ceab70b43b781f1d45f55eb
commit: a99ab6f395a9e45ca3f9047e9b88d6e02737419f ASoC: tegra: Add Tegra210 based ADX driver
date: 10 weeks ago
config: riscv-randconfig-s032-20211126 (https://download.01.org/0day-ci/archive/20211127/202111270332.sDUjP9Xg-lkp@xxxxxxxxx/config)
compiler: riscv32-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a99ab6f395a9e45ca3f9047e9b88d6e02737419f
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout a99ab6f395a9e45ca3f9047e9b88d6e02737419f
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=riscv SHELL=/bin/bash sound/soc/tegra/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)
>> sound/soc/tegra/tegra210_adx.c:125:14: sparse: sparse: restricted snd_pcm_format_t degrades to integer
sound/soc/tegra/tegra210_adx.c:128:14: sparse: sparse: restricted snd_pcm_format_t degrades to integer
sound/soc/tegra/tegra210_adx.c:131:14: sparse: sparse: restricted snd_pcm_format_t degrades to integer
>> sound/soc/tegra/tegra210_adx.c:153:38: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected unsigned int format @@ got restricted snd_pcm_format_t @@
sound/soc/tegra/tegra210_adx.c:153:38: sparse: expected unsigned int format
sound/soc/tegra/tegra210_adx.c:153:38: sparse: got restricted snd_pcm_format_t
sound/soc/tegra/tegra210_adx.c:162:56: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected unsigned int format @@ got restricted snd_pcm_format_t @@
sound/soc/tegra/tegra210_adx.c:162:56: sparse: expected unsigned int format
sound/soc/tegra/tegra210_adx.c:162:56: sparse: got restricted snd_pcm_format_t

vim +125 sound/soc/tegra/tegra210_adx.c

109
110 static int tegra210_adx_set_audio_cif(struct snd_soc_dai *dai,
111 unsigned int channels,
112 unsigned int format,
113 unsigned int reg)
114 {
115 struct tegra210_adx *adx = snd_soc_dai_get_drvdata(dai);
116 struct tegra_cif_conf cif_conf;
117 int audio_bits;
118
119 memset(&cif_conf, 0, sizeof(struct tegra_cif_conf));
120
121 if (channels < 1 || channels > 16)
122 return -EINVAL;
123
124 switch (format) {
> 125 case SNDRV_PCM_FORMAT_S8:
126 audio_bits = TEGRA_ACIF_BITS_8;
127 break;
128 case SNDRV_PCM_FORMAT_S16_LE:
129 audio_bits = TEGRA_ACIF_BITS_16;
130 break;
131 case SNDRV_PCM_FORMAT_S32_LE:
132 audio_bits = TEGRA_ACIF_BITS_32;
133 break;
134 default:
135 return -EINVAL;
136 }
137
138 cif_conf.audio_ch = channels;
139 cif_conf.client_ch = channels;
140 cif_conf.audio_bits = audio_bits;
141 cif_conf.client_bits = audio_bits;
142
143 tegra_set_cif(adx->regmap, reg, &cif_conf);
144
145 return 0;
146 }
147
148 static int tegra210_adx_out_hw_params(struct snd_pcm_substream *substream,
149 struct snd_pcm_hw_params *params,
150 struct snd_soc_dai *dai)
151 {
152 return tegra210_adx_set_audio_cif(dai, params_channels(params),
> 153 params_format(params),
154 TEGRA210_ADX_TX1_CIF_CTRL + ((dai->id - 1) * TEGRA210_ADX_AUDIOCIF_CH_STRIDE));
155 }
156

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