tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: ff90dfd2579b2c7bc1f0baa0cb99c918c6c1ec64 commit: 4bec79242a6c9b54b9541de467a4bf231c0ad68e [9710/11791] ALSA: virtio: PCM substream operators config: microblaze-randconfig-s031-20210219 (attached as .config) compiler: microblaze-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-229-g60c1f270-dirty # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=4bec79242a6c9b54b9541de467a4bf231c0ad68e git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git git fetch --no-tags linux-next master git checkout 4bec79242a6c9b54b9541de467a4bf231c0ad68e # 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=microblaze 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/virtio/virtio_pcm_ops.c:17:11: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int alsa_bit @@ got restricted snd_pcm_format_t [usertype] @@ sound/virtio/virtio_pcm_ops.c:17:11: sparse: expected unsigned int alsa_bit sound/virtio/virtio_pcm_ops.c:17:11: sparse: got restricted snd_pcm_format_t [usertype] sound/virtio/virtio_pcm_ops.c:18:11: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int alsa_bit @@ got restricted snd_pcm_format_t [usertype] @@ sound/virtio/virtio_pcm_ops.c:18:11: sparse: expected unsigned int alsa_bit sound/virtio/virtio_pcm_ops.c:18:11: sparse: got restricted snd_pcm_format_t [usertype] sound/virtio/virtio_pcm_ops.c:19:11: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int alsa_bit @@ got restricted snd_pcm_format_t [usertype] @@ sound/virtio/virtio_pcm_ops.c:19:11: sparse: expected unsigned int alsa_bit sound/virtio/virtio_pcm_ops.c:19:11: sparse: got restricted snd_pcm_format_t [usertype] sound/virtio/virtio_pcm_ops.c:20:11: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int alsa_bit @@ got restricted snd_pcm_format_t [usertype] @@ sound/virtio/virtio_pcm_ops.c:20:11: sparse: expected unsigned int alsa_bit sound/virtio/virtio_pcm_ops.c:20:11: sparse: got restricted snd_pcm_format_t [usertype] sound/virtio/virtio_pcm_ops.c:21:11: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int alsa_bit @@ got restricted snd_pcm_format_t [usertype] @@ sound/virtio/virtio_pcm_ops.c:21:11: sparse: expected unsigned int alsa_bit sound/virtio/virtio_pcm_ops.c:21:11: sparse: got restricted snd_pcm_format_t [usertype] sound/virtio/virtio_pcm_ops.c:22:11: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int alsa_bit @@ got restricted snd_pcm_format_t [usertype] @@ sound/virtio/virtio_pcm_ops.c:22:11: sparse: expected unsigned int alsa_bit sound/virtio/virtio_pcm_ops.c:22:11: sparse: got restricted snd_pcm_format_t [usertype] sound/virtio/virtio_pcm_ops.c:23:11: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int alsa_bit @@ got restricted snd_pcm_format_t [usertype] @@ sound/virtio/virtio_pcm_ops.c:23:11: sparse: expected unsigned int alsa_bit sound/virtio/virtio_pcm_ops.c:23:11: sparse: got restricted snd_pcm_format_t [usertype] sound/virtio/virtio_pcm_ops.c:24:11: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int alsa_bit @@ got restricted snd_pcm_format_t [usertype] @@ sound/virtio/virtio_pcm_ops.c:24:11: sparse: expected unsigned int alsa_bit sound/virtio/virtio_pcm_ops.c:24:11: sparse: got restricted snd_pcm_format_t [usertype] sound/virtio/virtio_pcm_ops.c:25:11: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int alsa_bit @@ got restricted snd_pcm_format_t [usertype] @@ sound/virtio/virtio_pcm_ops.c:25:11: sparse: expected unsigned int alsa_bit sound/virtio/virtio_pcm_ops.c:25:11: sparse: got restricted snd_pcm_format_t [usertype] sound/virtio/virtio_pcm_ops.c:26:11: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int alsa_bit @@ got restricted snd_pcm_format_t [usertype] @@ sound/virtio/virtio_pcm_ops.c:26:11: sparse: expected unsigned int alsa_bit sound/virtio/virtio_pcm_ops.c:26:11: sparse: got restricted snd_pcm_format_t [usertype] sound/virtio/virtio_pcm_ops.c:27:11: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int alsa_bit @@ got restricted snd_pcm_format_t [usertype] @@ sound/virtio/virtio_pcm_ops.c:27:11: sparse: expected unsigned int alsa_bit sound/virtio/virtio_pcm_ops.c:27:11: sparse: got restricted snd_pcm_format_t [usertype] sound/virtio/virtio_pcm_ops.c:28:11: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int alsa_bit @@ got restricted snd_pcm_format_t [usertype] @@ sound/virtio/virtio_pcm_ops.c:28:11: sparse: expected unsigned int alsa_bit sound/virtio/virtio_pcm_ops.c:28:11: sparse: got restricted snd_pcm_format_t [usertype] sound/virtio/virtio_pcm_ops.c:29:11: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int alsa_bit @@ got restricted snd_pcm_format_t [usertype] @@ sound/virtio/virtio_pcm_ops.c:29:11: sparse: expected unsigned int alsa_bit sound/virtio/virtio_pcm_ops.c:29:11: sparse: got restricted snd_pcm_format_t [usertype] sound/virtio/virtio_pcm_ops.c:30:11: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int alsa_bit @@ got restricted snd_pcm_format_t [usertype] @@ sound/virtio/virtio_pcm_ops.c:30:11: sparse: expected unsigned int alsa_bit sound/virtio/virtio_pcm_ops.c:30:11: sparse: got restricted snd_pcm_format_t [usertype] sound/virtio/virtio_pcm_ops.c:31:11: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int alsa_bit @@ got restricted snd_pcm_format_t [usertype] @@ sound/virtio/virtio_pcm_ops.c:31:11: sparse: expected unsigned int alsa_bit sound/virtio/virtio_pcm_ops.c:31:11: sparse: got restricted snd_pcm_format_t [usertype] sound/virtio/virtio_pcm_ops.c:32:11: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int alsa_bit @@ got restricted snd_pcm_format_t [usertype] @@ sound/virtio/virtio_pcm_ops.c:32:11: sparse: expected unsigned int alsa_bit sound/virtio/virtio_pcm_ops.c:32:11: sparse: got restricted snd_pcm_format_t [usertype] sound/virtio/virtio_pcm_ops.c:33:11: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int alsa_bit @@ got restricted snd_pcm_format_t [usertype] @@ sound/virtio/virtio_pcm_ops.c:33:11: sparse: expected unsigned int alsa_bit sound/virtio/virtio_pcm_ops.c:33:11: sparse: got restricted snd_pcm_format_t [usertype] sound/virtio/virtio_pcm_ops.c:34:11: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int alsa_bit @@ got restricted snd_pcm_format_t [usertype] @@ sound/virtio/virtio_pcm_ops.c:34:11: sparse: expected unsigned int alsa_bit sound/virtio/virtio_pcm_ops.c:34:11: sparse: got restricted snd_pcm_format_t [usertype] sound/virtio/virtio_pcm_ops.c:35:11: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int alsa_bit @@ got restricted snd_pcm_format_t [usertype] @@ sound/virtio/virtio_pcm_ops.c:35:11: sparse: expected unsigned int alsa_bit sound/virtio/virtio_pcm_ops.c:35:11: sparse: got restricted snd_pcm_format_t [usertype] sound/virtio/virtio_pcm_ops.c:36:11: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int alsa_bit @@ got restricted snd_pcm_format_t [usertype] @@ sound/virtio/virtio_pcm_ops.c:36:11: sparse: expected unsigned int alsa_bit sound/virtio/virtio_pcm_ops.c:36:11: sparse: got restricted snd_pcm_format_t [usertype] sound/virtio/virtio_pcm_ops.c:37:11: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int alsa_bit @@ got restricted snd_pcm_format_t [usertype] @@ sound/virtio/virtio_pcm_ops.c:37:11: sparse: expected unsigned int alsa_bit sound/virtio/virtio_pcm_ops.c:37:11: sparse: got restricted snd_pcm_format_t [usertype] sound/virtio/virtio_pcm_ops.c:38:11: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int alsa_bit @@ got restricted snd_pcm_format_t [usertype] @@ sound/virtio/virtio_pcm_ops.c:38:11: sparse: expected unsigned int alsa_bit sound/virtio/virtio_pcm_ops.c:38:11: sparse: got restricted snd_pcm_format_t [usertype] sound/virtio/virtio_pcm_ops.c:39:11: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int alsa_bit @@ got restricted snd_pcm_format_t [usertype] @@ sound/virtio/virtio_pcm_ops.c:39:11: sparse: expected unsigned int alsa_bit sound/virtio/virtio_pcm_ops.c:39:11: sparse: got restricted snd_pcm_format_t [usertype] sound/virtio/virtio_pcm_ops.c:40:11: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int alsa_bit @@ got restricted snd_pcm_format_t [usertype] @@ sound/virtio/virtio_pcm_ops.c:40:11: sparse: expected unsigned int alsa_bit sound/virtio/virtio_pcm_ops.c:40:11: sparse: got restricted snd_pcm_format_t [usertype] sound/virtio/virtio_pcm_ops.c:41:11: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int alsa_bit @@ got restricted snd_pcm_format_t [usertype] @@ sound/virtio/virtio_pcm_ops.c:41:11: sparse: expected unsigned int alsa_bit sound/virtio/virtio_pcm_ops.c:41:11: sparse: got restricted snd_pcm_format_t [usertype] >> sound/virtio/virtio_pcm_ops.c:181:53: sparse: sparse: restricted snd_pcm_format_t degrades to integer >> sound/virtio/virtio_pcm_ops.c:203:31: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] buffer_bytes @@ got restricted __virtio32 @@ sound/virtio/virtio_pcm_ops.c:203:31: sparse: expected restricted __le32 [usertype] buffer_bytes sound/virtio/virtio_pcm_ops.c:203:31: sparse: got restricted __virtio32 >> sound/virtio/virtio_pcm_ops.c:204:31: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] period_bytes @@ got restricted __virtio32 @@ sound/virtio/virtio_pcm_ops.c:204:31: sparse: expected restricted __le32 [usertype] period_bytes sound/virtio/virtio_pcm_ops.c:204:31: sparse: got restricted __virtio32 >> sound/virtio/virtio_pcm_ops.c:210:35: sparse: sparse: invalid assignment: |= >> sound/virtio/virtio_pcm_ops.c:210:35: sparse: left side has type restricted __le32 >> sound/virtio/virtio_pcm_ops.c:210:35: sparse: right side has type restricted __virtio32 sound/virtio/virtio_pcm_ops.c:215:35: sparse: sparse: invalid assignment: |= sound/virtio/virtio_pcm_ops.c:215:35: sparse: left side has type restricted __le32 sound/virtio/virtio_pcm_ops.c:215:35: sparse: right side has type restricted __virtio32 vim +17 sound/virtio/virtio_pcm_ops.c 15 16 static const struct virtsnd_a2v_format g_a2v_format_map[] = { > 17 { SNDRV_PCM_FORMAT_IMA_ADPCM, VIRTIO_SND_PCM_FMT_IMA_ADPCM }, 18 { SNDRV_PCM_FORMAT_MU_LAW, VIRTIO_SND_PCM_FMT_MU_LAW }, 19 { SNDRV_PCM_FORMAT_A_LAW, VIRTIO_SND_PCM_FMT_A_LAW }, 20 { SNDRV_PCM_FORMAT_S8, VIRTIO_SND_PCM_FMT_S8 }, 21 { SNDRV_PCM_FORMAT_U8, VIRTIO_SND_PCM_FMT_U8 }, 22 { SNDRV_PCM_FORMAT_S16_LE, VIRTIO_SND_PCM_FMT_S16 }, 23 { SNDRV_PCM_FORMAT_U16_LE, VIRTIO_SND_PCM_FMT_U16 }, 24 { SNDRV_PCM_FORMAT_S18_3LE, VIRTIO_SND_PCM_FMT_S18_3 }, 25 { SNDRV_PCM_FORMAT_U18_3LE, VIRTIO_SND_PCM_FMT_U18_3 }, 26 { SNDRV_PCM_FORMAT_S20_3LE, VIRTIO_SND_PCM_FMT_S20_3 }, 27 { SNDRV_PCM_FORMAT_U20_3LE, VIRTIO_SND_PCM_FMT_U20_3 }, 28 { SNDRV_PCM_FORMAT_S24_3LE, VIRTIO_SND_PCM_FMT_S24_3 }, 29 { SNDRV_PCM_FORMAT_U24_3LE, VIRTIO_SND_PCM_FMT_U24_3 }, 30 { SNDRV_PCM_FORMAT_S20_LE, VIRTIO_SND_PCM_FMT_S20 }, 31 { SNDRV_PCM_FORMAT_U20_LE, VIRTIO_SND_PCM_FMT_U20 }, 32 { SNDRV_PCM_FORMAT_S24_LE, VIRTIO_SND_PCM_FMT_S24 }, 33 { SNDRV_PCM_FORMAT_U24_LE, VIRTIO_SND_PCM_FMT_U24 }, 34 { SNDRV_PCM_FORMAT_S32_LE, VIRTIO_SND_PCM_FMT_S32 }, 35 { SNDRV_PCM_FORMAT_U32_LE, VIRTIO_SND_PCM_FMT_U32 }, 36 { SNDRV_PCM_FORMAT_FLOAT_LE, VIRTIO_SND_PCM_FMT_FLOAT }, 37 { SNDRV_PCM_FORMAT_FLOAT64_LE, VIRTIO_SND_PCM_FMT_FLOAT64 }, 38 { SNDRV_PCM_FORMAT_DSD_U8, VIRTIO_SND_PCM_FMT_DSD_U8 }, 39 { SNDRV_PCM_FORMAT_DSD_U16_LE, VIRTIO_SND_PCM_FMT_DSD_U16 }, 40 { SNDRV_PCM_FORMAT_DSD_U32_LE, VIRTIO_SND_PCM_FMT_DSD_U32 }, 41 { SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE, 42 VIRTIO_SND_PCM_FMT_IEC958_SUBFRAME } 43 }; 44 45 /* Map for converting ALSA frame rate to VirtIO frame rate. */ 46 struct virtsnd_a2v_rate { 47 unsigned int rate; 48 unsigned int vio_bit; 49 }; 50 51 static const struct virtsnd_a2v_rate g_a2v_rate_map[] = { 52 { 5512, VIRTIO_SND_PCM_RATE_5512 }, 53 { 8000, VIRTIO_SND_PCM_RATE_8000 }, 54 { 11025, VIRTIO_SND_PCM_RATE_11025 }, 55 { 16000, VIRTIO_SND_PCM_RATE_16000 }, 56 { 22050, VIRTIO_SND_PCM_RATE_22050 }, 57 { 32000, VIRTIO_SND_PCM_RATE_32000 }, 58 { 44100, VIRTIO_SND_PCM_RATE_44100 }, 59 { 48000, VIRTIO_SND_PCM_RATE_48000 }, 60 { 64000, VIRTIO_SND_PCM_RATE_64000 }, 61 { 88200, VIRTIO_SND_PCM_RATE_88200 }, 62 { 96000, VIRTIO_SND_PCM_RATE_96000 }, 63 { 176400, VIRTIO_SND_PCM_RATE_176400 }, 64 { 192000, VIRTIO_SND_PCM_RATE_192000 } 65 }; 66 67 static int virtsnd_pcm_sync_stop(struct snd_pcm_substream *substream); 68 69 /** 70 * virtsnd_pcm_open() - Open the PCM substream. 71 * @substream: Kernel ALSA substream. 72 * 73 * Context: Process context. 74 * Return: 0 on success, -errno on failure. 75 */ 76 static int virtsnd_pcm_open(struct snd_pcm_substream *substream) 77 { 78 struct virtio_pcm *vpcm = snd_pcm_substream_chip(substream); 79 struct virtio_pcm_substream *vss = NULL; 80 81 if (vpcm) { 82 switch (substream->stream) { 83 case SNDRV_PCM_STREAM_PLAYBACK: 84 case SNDRV_PCM_STREAM_CAPTURE: { 85 struct virtio_pcm_stream *vs = 86 &vpcm->streams[substream->stream]; 87 88 if (substream->number < vs->nsubstreams) 89 vss = vs->substreams[substream->number]; 90 break; 91 } 92 } 93 } 94 95 if (!vss) 96 return -EBADFD; 97 98 substream->runtime->hw = vss->hw; 99 substream->private_data = vss; 100 101 snd_pcm_hw_constraint_integer(substream->runtime, 102 SNDRV_PCM_HW_PARAM_PERIODS); 103 104 /* 105 * If the substream has already been used, then the I/O queue may be in 106 * an invalid state. Just in case, we do a check and try to return the 107 * queue to its original state, if necessary. 108 */ 109 vss->msg_flushing = true; 110 111 return virtsnd_pcm_sync_stop(substream); 112 } 113 114 /** 115 * virtsnd_pcm_close() - Close the PCM substream. 116 * @substream: Kernel ALSA substream. 117 * 118 * Context: Process context. 119 * Return: 0. 120 */ 121 static int virtsnd_pcm_close(struct snd_pcm_substream *substream) 122 { 123 return 0; 124 } 125 126 /** 127 * virtsnd_pcm_hw_params() - Set the parameters of the PCM substream. 128 * @substream: Kernel ALSA substream. 129 * @hw_params: Hardware parameters (can be NULL). 130 * 131 * The function can be called both from the upper level (in this case, 132 * @hw_params is not NULL) or from the driver itself (in this case, @hw_params 133 * is NULL, and the parameter values are taken from the runtime structure). 134 * 135 * Context: Process context. 136 * Return: 0 on success, -errno on failure. 137 */ 138 static int virtsnd_pcm_hw_params(struct snd_pcm_substream *substream, 139 struct snd_pcm_hw_params *hw_params) 140 { 141 struct snd_pcm_runtime *runtime = substream->runtime; 142 struct virtio_pcm_substream *vss = snd_pcm_substream_chip(substream); 143 struct virtio_device *vdev = vss->snd->vdev; 144 struct virtio_snd_msg *msg; 145 struct virtio_snd_pcm_set_params *request; 146 snd_pcm_format_t format; 147 unsigned int channels; 148 unsigned int rate; 149 unsigned int buffer_bytes; 150 unsigned int period_bytes; 151 unsigned int periods; 152 unsigned int i; 153 int vformat = -1; 154 int vrate = -1; 155 int rc; 156 157 if (vss->msg_flushing) { 158 dev_err(&vdev->dev, "SID %u: invalid I/O queue state\n", 159 vss->sid); 160 return -EBADFD; 161 } 162 163 /* Set hardware parameters in device */ 164 if (hw_params) { 165 format = params_format(hw_params); 166 channels = params_channels(hw_params); 167 rate = params_rate(hw_params); 168 buffer_bytes = params_buffer_bytes(hw_params); 169 period_bytes = params_period_bytes(hw_params); 170 periods = params_periods(hw_params); 171 } else { 172 format = runtime->format; 173 channels = runtime->channels; 174 rate = runtime->rate; 175 buffer_bytes = frames_to_bytes(runtime, runtime->buffer_size); 176 period_bytes = frames_to_bytes(runtime, runtime->period_size); 177 periods = runtime->periods; 178 } 179 180 for (i = 0; i < ARRAY_SIZE(g_a2v_format_map); ++i) > 181 if (g_a2v_format_map[i].alsa_bit == format) { 182 vformat = g_a2v_format_map[i].vio_bit; 183 184 break; 185 } 186 187 for (i = 0; i < ARRAY_SIZE(g_a2v_rate_map); ++i) 188 if (g_a2v_rate_map[i].rate == rate) { 189 vrate = g_a2v_rate_map[i].vio_bit; 190 191 break; 192 } 193 194 if (vformat == -1 || vrate == -1) 195 return -EINVAL; 196 197 msg = virtsnd_pcm_ctl_msg_alloc(vss, VIRTIO_SND_R_PCM_SET_PARAMS, 198 GFP_KERNEL); 199 if (!msg) 200 return -ENOMEM; 201 202 request = virtsnd_ctl_msg_request(msg); > 203 request->buffer_bytes = cpu_to_virtio32(vdev, buffer_bytes); > 204 request->period_bytes = cpu_to_virtio32(vdev, period_bytes); 205 request->channels = channels; 206 request->format = vformat; 207 request->rate = vrate; 208 209 if (vss->features & (1U << VIRTIO_SND_PCM_F_MSG_POLLING)) > 210 request->features |= 211 cpu_to_virtio32(vdev, 212 1U << VIRTIO_SND_PCM_F_MSG_POLLING); 213 214 if (vss->features & (1U << VIRTIO_SND_PCM_F_EVT_XRUNS)) 215 request->features |= 216 cpu_to_virtio32(vdev, 217 1U << VIRTIO_SND_PCM_F_EVT_XRUNS); 218 219 rc = virtsnd_ctl_msg_send_sync(vss->snd, msg); 220 if (rc) 221 return rc; 222 223 return virtsnd_pcm_msg_alloc(vss, periods, period_bytes); 224 } 225 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip