sound/soc/fsl/imx-pcm-rpmsg.c:164:43: sparse: sparse: incorrect type in assignment (different base types)

From: kernel test robot
Date: Sat May 01 2021 - 13:54:54 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 9f67672a817ec046f7554a885f0fe0d60e1bf99f
commit: 39f8405c3e502e7b9d0533fa0b0bfe715b3e89c1 ASoC: imx-rpmsg: Add machine driver for audio base on rpmsg
date: 5 weeks ago
config: openrisc-randconfig-s032-20210502 (attached as .config)
compiler: or1k-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-341-g8af24329-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=39f8405c3e502e7b9d0533fa0b0bfe715b3e89c1
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 39f8405c3e502e7b9d0533fa0b0bfe715b3e89c1
# 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__' W=1 ARCH=openrisc

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/fsl/imx-pcm-rpmsg.c:164:43: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned char format @@ got restricted snd_pcm_format_t [usertype] @@
sound/soc/fsl/imx-pcm-rpmsg.c:164:43: sparse: expected unsigned char format
sound/soc/fsl/imx-pcm-rpmsg.c:164:43: sparse: got restricted snd_pcm_format_t [usertype]
sound/soc/fsl/imx-pcm-rpmsg.c:167:43: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned char format @@ got restricted snd_pcm_format_t [usertype] @@
sound/soc/fsl/imx-pcm-rpmsg.c:167:43: sparse: expected unsigned char format
sound/soc/fsl/imx-pcm-rpmsg.c:167:43: sparse: got restricted snd_pcm_format_t [usertype]

vim +164 sound/soc/fsl/imx-pcm-rpmsg.c

3c00eceb2a5391 Shengjiu Wang 2021-03-12 136
3c00eceb2a5391 Shengjiu Wang 2021-03-12 137 static int imx_rpmsg_pcm_hw_params(struct snd_soc_component *component,
3c00eceb2a5391 Shengjiu Wang 2021-03-12 138 struct snd_pcm_substream *substream,
3c00eceb2a5391 Shengjiu Wang 2021-03-12 139 struct snd_pcm_hw_params *params)
3c00eceb2a5391 Shengjiu Wang 2021-03-12 140 {
3c00eceb2a5391 Shengjiu Wang 2021-03-12 141 struct rpmsg_info *info = dev_get_drvdata(component->dev);
3c00eceb2a5391 Shengjiu Wang 2021-03-12 142 struct snd_pcm_runtime *runtime = substream->runtime;
3c00eceb2a5391 Shengjiu Wang 2021-03-12 143 struct rpmsg_msg *msg;
3c00eceb2a5391 Shengjiu Wang 2021-03-12 144 int ret = 0;
3c00eceb2a5391 Shengjiu Wang 2021-03-12 145
3c00eceb2a5391 Shengjiu Wang 2021-03-12 146 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
3c00eceb2a5391 Shengjiu Wang 2021-03-12 147 msg = &info->msg[TX_HW_PARAM];
3c00eceb2a5391 Shengjiu Wang 2021-03-12 148 msg->s_msg.header.cmd = TX_HW_PARAM;
3c00eceb2a5391 Shengjiu Wang 2021-03-12 149 } else {
3c00eceb2a5391 Shengjiu Wang 2021-03-12 150 msg = &info->msg[RX_HW_PARAM];
3c00eceb2a5391 Shengjiu Wang 2021-03-12 151 msg->s_msg.header.cmd = RX_HW_PARAM;
3c00eceb2a5391 Shengjiu Wang 2021-03-12 152 }
3c00eceb2a5391 Shengjiu Wang 2021-03-12 153
3c00eceb2a5391 Shengjiu Wang 2021-03-12 154 msg->s_msg.param.rate = params_rate(params);
3c00eceb2a5391 Shengjiu Wang 2021-03-12 155
3c00eceb2a5391 Shengjiu Wang 2021-03-12 156 switch (params_format(params)) {
3c00eceb2a5391 Shengjiu Wang 2021-03-12 157 case SNDRV_PCM_FORMAT_S16_LE:
3c00eceb2a5391 Shengjiu Wang 2021-03-12 158 msg->s_msg.param.format = RPMSG_S16_LE;
3c00eceb2a5391 Shengjiu Wang 2021-03-12 159 break;
3c00eceb2a5391 Shengjiu Wang 2021-03-12 160 case SNDRV_PCM_FORMAT_S24_LE:
3c00eceb2a5391 Shengjiu Wang 2021-03-12 161 msg->s_msg.param.format = RPMSG_S24_LE;
3c00eceb2a5391 Shengjiu Wang 2021-03-12 162 break;
3c00eceb2a5391 Shengjiu Wang 2021-03-12 163 case SNDRV_PCM_FORMAT_DSD_U16_LE:
3c00eceb2a5391 Shengjiu Wang 2021-03-12 @164 msg->s_msg.param.format = SNDRV_PCM_FORMAT_DSD_U16_LE;
3c00eceb2a5391 Shengjiu Wang 2021-03-12 165 break;
3c00eceb2a5391 Shengjiu Wang 2021-03-12 166 case SNDRV_PCM_FORMAT_DSD_U32_LE:
3c00eceb2a5391 Shengjiu Wang 2021-03-12 167 msg->s_msg.param.format = SNDRV_PCM_FORMAT_DSD_U32_LE;
3c00eceb2a5391 Shengjiu Wang 2021-03-12 168 break;
3c00eceb2a5391 Shengjiu Wang 2021-03-12 169 default:
3c00eceb2a5391 Shengjiu Wang 2021-03-12 170 msg->s_msg.param.format = RPMSG_S32_LE;
3c00eceb2a5391 Shengjiu Wang 2021-03-12 171 break;
3c00eceb2a5391 Shengjiu Wang 2021-03-12 172 }
3c00eceb2a5391 Shengjiu Wang 2021-03-12 173
3c00eceb2a5391 Shengjiu Wang 2021-03-12 174 switch (params_channels(params)) {
3c00eceb2a5391 Shengjiu Wang 2021-03-12 175 case 1:
3c00eceb2a5391 Shengjiu Wang 2021-03-12 176 msg->s_msg.param.channels = RPMSG_CH_LEFT;
3c00eceb2a5391 Shengjiu Wang 2021-03-12 177 break;
3c00eceb2a5391 Shengjiu Wang 2021-03-12 178 case 2:
3c00eceb2a5391 Shengjiu Wang 2021-03-12 179 msg->s_msg.param.channels = RPMSG_CH_STEREO;
3c00eceb2a5391 Shengjiu Wang 2021-03-12 180 break;
3c00eceb2a5391 Shengjiu Wang 2021-03-12 181 default:
3c00eceb2a5391 Shengjiu Wang 2021-03-12 182 ret = -EINVAL;
3c00eceb2a5391 Shengjiu Wang 2021-03-12 183 break;
3c00eceb2a5391 Shengjiu Wang 2021-03-12 184 }
3c00eceb2a5391 Shengjiu Wang 2021-03-12 185
3c00eceb2a5391 Shengjiu Wang 2021-03-12 186 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
3c00eceb2a5391 Shengjiu Wang 2021-03-12 187 runtime->dma_bytes = params_buffer_bytes(params);
3c00eceb2a5391 Shengjiu Wang 2021-03-12 188
3c00eceb2a5391 Shengjiu Wang 2021-03-12 189 info->send_message(msg, info);
3c00eceb2a5391 Shengjiu Wang 2021-03-12 190
3c00eceb2a5391 Shengjiu Wang 2021-03-12 191 return ret;
3c00eceb2a5391 Shengjiu Wang 2021-03-12 192 }
3c00eceb2a5391 Shengjiu Wang 2021-03-12 193

:::::: The code at line 164 was first introduced by commit
:::::: 3c00eceb2a5391ed1ca6703b71cad35ab8cd4352 ASoC: imx-pcm-rpmsg: Add platform driver for audio base on rpmsg

:::::: TO: Shengjiu Wang <shengjiu.wang@xxxxxxx>
:::::: CC: Mark Brown <broonie@xxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip