[PATCH] ASoC: wm_adsp: Improve handling of raw byte streams

kernel test robot lkp at intel.com
Sat Dec 26 17:13:46 CET 2020


Hi Richard,

I love your patch! Perhaps something to improve:

[auto build test WARNING on asoc/for-next]
[also build test WARNING on v5.10 next-20201223]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Richard-Fitzgerald/ASoC-wm_adsp-Improve-handling-of-raw-byte-streams/20201216-193614
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: arm64-randconfig-s032-20201223 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.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.3-184-g1b896707-dirty
        # https://github.com/0day-ci/linux/commit/e68819993ab2e0f2870bf9ca578f6b3713358419
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Richard-Fitzgerald/ASoC-wm_adsp-Improve-handling-of-raw-byte-streams/20201216-193614
        git checkout e68819993ab2e0f2870bf9ca578f6b3713358419
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>


"sparse warnings: (new ones prefixed by >>)"
   sound/soc/codecs/wm_adsp.c:983:19: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned int [usertype] val @@     got restricted __be32 [usertype] @@
   sound/soc/codecs/wm_adsp.c:983:19: sparse:     expected unsigned int [usertype] val
   sound/soc/codecs/wm_adsp.c:983:19: sparse:     got restricted __be32 [usertype]
   sound/soc/codecs/wm_adsp.c:1710:22: sparse: sparse: restricted snd_ctl_elem_type_t degrades to integer
   sound/soc/codecs/wm_adsp.c:2329:54: sparse: sparse: incorrect type in argument 8 (different base types) @@     expected unsigned int type @@     got restricted snd_ctl_elem_type_t [usertype] @@
   sound/soc/codecs/wm_adsp.c:2329:54: sparse:     expected unsigned int type
   sound/soc/codecs/wm_adsp.c:2329:54: sparse:     got restricted snd_ctl_elem_type_t [usertype]
   sound/soc/codecs/wm_adsp.c:2350:54: sparse: sparse: incorrect type in argument 8 (different base types) @@     expected unsigned int type @@     got restricted snd_ctl_elem_type_t [usertype] @@
   sound/soc/codecs/wm_adsp.c:2350:54: sparse:     expected unsigned int type
   sound/soc/codecs/wm_adsp.c:2350:54: sparse:     got restricted snd_ctl_elem_type_t [usertype]
   sound/soc/codecs/wm_adsp.c:2437:54: sparse: sparse: incorrect type in argument 8 (different base types) @@     expected unsigned int type @@     got restricted snd_ctl_elem_type_t [usertype] @@
   sound/soc/codecs/wm_adsp.c:2437:54: sparse:     expected unsigned int type
   sound/soc/codecs/wm_adsp.c:2437:54: sparse:     got restricted snd_ctl_elem_type_t [usertype]
   sound/soc/codecs/wm_adsp.c:2458:54: sparse: sparse: incorrect type in argument 8 (different base types) @@     expected unsigned int type @@     got restricted snd_ctl_elem_type_t [usertype] @@
   sound/soc/codecs/wm_adsp.c:2458:54: sparse:     expected unsigned int type
   sound/soc/codecs/wm_adsp.c:2458:54: sparse:     got restricted snd_ctl_elem_type_t [usertype]
   sound/soc/codecs/wm_adsp.c:2479:54: sparse: sparse: incorrect type in argument 8 (different base types) @@     expected unsigned int type @@     got restricted snd_ctl_elem_type_t [usertype] @@
   sound/soc/codecs/wm_adsp.c:2479:54: sparse:     expected unsigned int type
   sound/soc/codecs/wm_adsp.c:2479:54: sparse:     got restricted snd_ctl_elem_type_t [usertype]
   sound/soc/codecs/wm_adsp.c:3714:14: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] data @@     got restricted __be32 [usertype] @@
   sound/soc/codecs/wm_adsp.c:3714:14: sparse:     expected unsigned int [usertype] data
   sound/soc/codecs/wm_adsp.c:3714:14: sparse:     got restricted __be32 [usertype]
   sound/soc/codecs/wm_adsp.c:3901:29: sparse: sparse: cast to restricted __be32
   sound/soc/codecs/wm_adsp.c:3921:27: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __be32 [addressable] [usertype] versions @@     got unsigned int [usertype] @@
   sound/soc/codecs/wm_adsp.c:3921:27: sparse:     expected restricted __be32 [addressable] [usertype] versions
   sound/soc/codecs/wm_adsp.c:3921:27: sparse:     got unsigned int [usertype]
   sound/soc/codecs/wm_adsp.c:3922:23: sparse: sparse: restricted __be32 degrades to integer
>> sound/soc/codecs/wm_adsp.c:4272:56: sparse: sparse: incorrect type in argument 5 (different base types) @@     expected restricted __be32 [usertype] *data @@     got unsigned int [usertype] *raw_buf @@
   sound/soc/codecs/wm_adsp.c:4272:56: sparse:     expected restricted __be32 [usertype] *data
   sound/soc/codecs/wm_adsp.c:4272:56: sparse:     got unsigned int [usertype] *raw_buf

vim +4272 sound/soc/codecs/wm_adsp.c

565ace464105cb9 Charles Keepax     2016-01-06  4238  
83a40ce993cda07 Charles Keepax     2016-01-06  4239  static int wm_adsp_buffer_capture_block(struct wm_adsp_compr *compr, int target)
83a40ce993cda07 Charles Keepax     2016-01-06  4240  {
83a40ce993cda07 Charles Keepax     2016-01-06  4241  	struct wm_adsp_compr_buf *buf = compr->buf;
83a40ce993cda07 Charles Keepax     2016-01-06  4242  	unsigned int adsp_addr;
83a40ce993cda07 Charles Keepax     2016-01-06  4243  	int mem_type, nwords, max_read;
cc7d6ce90216d10 Charles Keepax     2019-02-22  4244  	int i, ret;
83a40ce993cda07 Charles Keepax     2016-01-06  4245  
83a40ce993cda07 Charles Keepax     2016-01-06  4246  	/* Calculate read parameters */
83a40ce993cda07 Charles Keepax     2016-01-06  4247  	for (i = 0; i < wm_adsp_fw[buf->dsp->fw].caps->num_regions; ++i)
83a40ce993cda07 Charles Keepax     2016-01-06  4248  		if (buf->read_index < buf->regions[i].cumulative_size)
83a40ce993cda07 Charles Keepax     2016-01-06  4249  			break;
83a40ce993cda07 Charles Keepax     2016-01-06  4250  
83a40ce993cda07 Charles Keepax     2016-01-06  4251  	if (i == wm_adsp_fw[buf->dsp->fw].caps->num_regions)
83a40ce993cda07 Charles Keepax     2016-01-06  4252  		return -EINVAL;
83a40ce993cda07 Charles Keepax     2016-01-06  4253  
83a40ce993cda07 Charles Keepax     2016-01-06  4254  	mem_type = buf->regions[i].mem_type;
83a40ce993cda07 Charles Keepax     2016-01-06  4255  	adsp_addr = buf->regions[i].base_addr +
83a40ce993cda07 Charles Keepax     2016-01-06  4256  		    (buf->read_index - buf->regions[i].offset);
83a40ce993cda07 Charles Keepax     2016-01-06  4257  
83a40ce993cda07 Charles Keepax     2016-01-06  4258  	max_read = wm_adsp_compr_frag_words(compr);
83a40ce993cda07 Charles Keepax     2016-01-06  4259  	nwords = buf->regions[i].cumulative_size - buf->read_index;
83a40ce993cda07 Charles Keepax     2016-01-06  4260  
83a40ce993cda07 Charles Keepax     2016-01-06  4261  	if (nwords > target)
83a40ce993cda07 Charles Keepax     2016-01-06  4262  		nwords = target;
83a40ce993cda07 Charles Keepax     2016-01-06  4263  	if (nwords > buf->avail)
83a40ce993cda07 Charles Keepax     2016-01-06  4264  		nwords = buf->avail;
83a40ce993cda07 Charles Keepax     2016-01-06  4265  	if (nwords > max_read)
83a40ce993cda07 Charles Keepax     2016-01-06  4266  		nwords = max_read;
83a40ce993cda07 Charles Keepax     2016-01-06  4267  	if (!nwords)
83a40ce993cda07 Charles Keepax     2016-01-06  4268  		return 0;
83a40ce993cda07 Charles Keepax     2016-01-06  4269  
83a40ce993cda07 Charles Keepax     2016-01-06  4270  	/* Read data from DSP */
e68819993ab2e0f Richard Fitzgerald 2020-12-16  4271  	ret = wm_adsp_read_raw_data_block(buf->dsp, mem_type, adsp_addr,
83a40ce993cda07 Charles Keepax     2016-01-06 @4272  					  nwords, compr->raw_buf);
83a40ce993cda07 Charles Keepax     2016-01-06  4273  	if (ret < 0)
83a40ce993cda07 Charles Keepax     2016-01-06  4274  		return ret;
83a40ce993cda07 Charles Keepax     2016-01-06  4275  
e68819993ab2e0f Richard Fitzgerald 2020-12-16  4276  	wm_adsp_remove_padding(compr->raw_buf, nwords);
83a40ce993cda07 Charles Keepax     2016-01-06  4277  
83a40ce993cda07 Charles Keepax     2016-01-06  4278  	/* update read index to account for words read */
83a40ce993cda07 Charles Keepax     2016-01-06  4279  	buf->read_index += nwords;
83a40ce993cda07 Charles Keepax     2016-01-06  4280  	if (buf->read_index == wm_adsp_buffer_size(buf))
83a40ce993cda07 Charles Keepax     2016-01-06  4281  		buf->read_index = 0;
83a40ce993cda07 Charles Keepax     2016-01-06  4282  
83a40ce993cda07 Charles Keepax     2016-01-06  4283  	ret = wm_adsp_buffer_write(buf, HOST_BUFFER_FIELD(next_read_index),
83a40ce993cda07 Charles Keepax     2016-01-06  4284  				   buf->read_index);
83a40ce993cda07 Charles Keepax     2016-01-06  4285  	if (ret < 0)
83a40ce993cda07 Charles Keepax     2016-01-06  4286  		return ret;
83a40ce993cda07 Charles Keepax     2016-01-06  4287  
83a40ce993cda07 Charles Keepax     2016-01-06  4288  	/* update avail to account for words read */
83a40ce993cda07 Charles Keepax     2016-01-06  4289  	buf->avail -= nwords;
83a40ce993cda07 Charles Keepax     2016-01-06  4290  
83a40ce993cda07 Charles Keepax     2016-01-06  4291  	return nwords;
83a40ce993cda07 Charles Keepax     2016-01-06  4292  }
83a40ce993cda07 Charles Keepax     2016-01-06  4293  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 47973 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20201227/46dc7ba0/attachment-0001.gz>


More information about the Alsa-devel mailing list