ALSA: pcm: Use standard macros for fixing PCM format cast
Simplify the code with the new macros for PCM format type iterations. This fixes the sparse warnings nicely: sound/core/pcm_native.c:2302:26: warning: restricted snd_pcm_format_t degrades to integer sound/core/pcm_native.c:2306:54: warning: incorrect type in argument 1 (different base types) sound/core/pcm_native.c:2306:54: expected restricted snd_pcm_format_t [usertype] format sound/core/pcm_native.c:2306:54: got unsigned int [assigned] k .... No functional changes, just sparse warning fixes. Link: https://lore.kernel.org/r/20200206163945.6797-6-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
@@ -884,20 +884,17 @@ static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream)
|
||||
sformat = snd_pcm_plug_slave_format(format, sformat_mask);
|
||||
|
||||
if ((__force int)sformat < 0 ||
|
||||
!snd_mask_test(sformat_mask, (__force int)sformat)) {
|
||||
for (sformat = (__force snd_pcm_format_t)0;
|
||||
(__force int)sformat <= (__force int)SNDRV_PCM_FORMAT_LAST;
|
||||
sformat = (__force snd_pcm_format_t)((__force int)sformat + 1)) {
|
||||
if (snd_mask_test(sformat_mask, (__force int)sformat) &&
|
||||
!snd_mask_test_format(sformat_mask, sformat)) {
|
||||
pcm_for_each_format(sformat) {
|
||||
if (snd_mask_test_format(sformat_mask, sformat) &&
|
||||
snd_pcm_oss_format_to(sformat) >= 0)
|
||||
break;
|
||||
}
|
||||
if ((__force int)sformat > (__force int)SNDRV_PCM_FORMAT_LAST) {
|
||||
pcm_dbg(substream->pcm, "Cannot find a format!!!\n");
|
||||
err = -EINVAL;
|
||||
goto failure;
|
||||
goto format_found;
|
||||
}
|
||||
pcm_dbg(substream->pcm, "Cannot find a format!!!\n");
|
||||
err = -EINVAL;
|
||||
goto failure;
|
||||
}
|
||||
format_found:
|
||||
err = _snd_pcm_hw_param_set(sparams, SNDRV_PCM_HW_PARAM_FORMAT, (__force int)sformat, 0);
|
||||
if (err < 0)
|
||||
goto failure;
|
||||
|
مرجع در شماره جدید
Block a user