tree: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.5 head: 1a476abc723e644248dba975b71122fcf878703b commit: e957204e732bc2916a241dc61dd7dd14e9a98350 [29/32] ASoC: pcm_dmaengine: Extract snd_dmaengine_pcm_refine_runtime_hwparams reproduce: # apt-get install sparse # sparse version: v0.6.1-rc1-37-gd466a02-dirty git checkout e957204e732bc2916a241dc61dd7dd14e9a98350 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/core/pcm_dmaengine.c:429:50: sparse: sparse: restricted snd_pcm_format_t degrades to integer
sound/core/pcm_dmaengine.c:429:55: sparse: sparse: restricted snd_pcm_format_t degrades to integer sound/core/pcm_dmaengine.c:429:79: sparse: sparse: restricted snd_pcm_format_t degrades to integer
vim +429 sound/core/pcm_dmaengine.c
371 372 /** 373 * snd_dmaengine_pcm_refine_runtime_hwparams - Refine runtime hw params 374 * @substream: PCM substream 375 * @dma_data: DAI DMA data 376 * @hw: PCM hw params 377 * @chan: DMA channel to use for data transfers 378 * 379 * Returns 0 on success, a negative error code otherwise. 380 * 381 * This function will query DMA capability, then refine the pcm hardware 382 * parameters. 383 */ 384 int snd_dmaengine_pcm_refine_runtime_hwparams( 385 struct snd_pcm_substream *substream, 386 struct snd_dmaengine_dai_dma_data *dma_data, 387 struct snd_pcm_hardware *hw, 388 struct dma_chan *chan) 389 { 390 struct dma_slave_caps dma_caps; 391 u32 addr_widths = BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) | 392 BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) | 393 BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); 394 snd_pcm_format_t i; 395 int ret = 0; 396 397 if (!hw || !chan || !dma_data) 398 return -EINVAL; 399 400 ret = dma_get_slave_caps(chan, &dma_caps); 401 if (ret == 0) { 402 if (dma_caps.cmd_pause && dma_caps.cmd_resume) 403 hw->info |= SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME; 404 if (dma_caps.residue_granularity <= DMA_RESIDUE_GRANULARITY_SEGMENT) 405 hw->info |= SNDRV_PCM_INFO_BATCH; 406 407 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 408 addr_widths = dma_caps.dst_addr_widths; 409 else 410 addr_widths = dma_caps.src_addr_widths; 411 } 412 413 /* 414 * If SND_DMAENGINE_PCM_DAI_FLAG_PACK is set keep 415 * hw.formats set to 0, meaning no restrictions are in place. 416 * In this case it's the responsibility of the DAI driver to 417 * provide the supported format information. 418 */ 419 if (!(dma_data->flags & SND_DMAENGINE_PCM_DAI_FLAG_PACK)) 420 /* 421 * Prepare formats mask for valid/allowed sample types. If the 422 * dma does not have support for the given physical word size, 423 * it needs to be masked out so user space can not use the 424 * format which produces corrupted audio. 425 * In case the dma driver does not implement the slave_caps the 426 * default assumption is that it supports 1, 2 and 4 bytes 427 * widths. 428 */
429 for (i = SNDRV_PCM_FORMAT_FIRST; i <= SNDRV_PCM_FORMAT_LAST; i++) {
430 int bits = snd_pcm_format_physical_width(i); 431 432 /* 433 * Enable only samples with DMA supported physical 434 * widths 435 */ 436 switch (bits) { 437 case 8: 438 case 16: 439 case 24: 440 case 32: 441 case 64: 442 if (addr_widths & (1 << (bits / 8))) 443 hw->formats |= pcm_format_to_bits(i); 444 break; 445 default: 446 /* Unsupported types */ 447 break; 448 } 449 } 450 451 return ret; 452 } 453 EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_refine_runtime_hwparams); 454
--- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation