[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
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
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>
On Fri, Oct 11, 2019 at 07:13:38AM -0500, Dan Murphy wrote:
On 10/10/19 11:41 AM, kbuild test robot wrote:
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
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 think so, yes. Or at least I can't see any sensible way to stop this anyway.
On 10/22/19 3:19 AM, Mark Brown wrote:
On Fri, Oct 11, 2019 at 07:13:38AM -0500, Dan Murphy wrote:
On 10/10/19 11:41 AM, kbuild test robot wrote:
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 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 think so, yes. Or at least I can't see any sensible way to stop this anyway.
Hi,
Sorry for the inconvenience, we'll take a look at it asap.
Best Regards, Rong Chen
On Mon, 21 Oct 2019 21:19:13 +0200, Mark Brown wrote:
On Fri, Oct 11, 2019 at 07:13:38AM -0500, Dan Murphy wrote:
On 10/10/19 11:41 AM, kbuild test robot wrote:
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
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 think so, yes. Or at least I can't see any sensible way to stop this anyway.
You can pass the real bit width (16, 24, 32) via snd_pcm_format_width().
BTW, the error message after tas2562_set_samplerate() seems bogus, still indicating the bitwidth instead of the rate.
thanks,
Takashi
participants (5)
-
Dan Murphy
-
kbuild test robot
-
Mark Brown
-
Rong Chen
-
Takashi Iwai