Missed the comments below in my earlier answer.
+ ret = snd_pcm_lib_preallocate_pages(pcm->streams[stream].substream, + SNDRV_DMA_TYPE_DEV_SG, sdev->dev,
- le32_to_cpu(caps->buffer_size_min),
- le32_to_cpu(caps->buffer_size_max));
+ if (ret) { + dev_err(sdev->dev, "error: can't alloc DMA buffer size 0x%x/0x%x for %s %d\n", + caps->buffer_size_min, caps->buffer_size_max, + caps->name, ret); + return ret; + }
The error check here is redundant, please drop. snd_pcm_lib_preallocate_pages() was changed to be void function recently, so it'll be a build error.
yes indeed. It's not on Mark's for-next branch so I missed it. Fixed now, thanks
+ snd_mask_none(fmt); + snd_mask_set(fmt, (__force int)SNDRV_PCM_FORMAT_S16_LE);
Use snd_mask_set_format() macro. That avoids the ugly cast.
Ah yes. Ironically I was the one who reported this ugly cast and didn't update our code with the new helper. Oops. Fixed now.