summaryrefslogtreecommitdiff
path: root/sound/soc/soc-generic-dmaengine-pcm.c
diff options
context:
space:
mode:
authorShengjiu Wang <shengjiu.wang@nxp.com>2022-01-20 10:44:02 +0800
committerMark Brown <broonie@kernel.org>2022-01-24 13:31:57 +0000
commit88c62b16281e5fe748f22f44da3def8a91fb1c34 (patch)
tree7059deeaeee3b5f06edab0224accfc26979524d4 /sound/soc/soc-generic-dmaengine-pcm.c
parentde531908ca4251918f3aff4b21440a8f7b96b0b7 (diff)
ASoC: soc-generic-dmaengine-pcm: separate max_buffer_size assignment
The config->pcm_hardware may be NULL when config->prealloc_buffer_size is not zero, so it is better to move max_buffer_size assignment under a separate condition. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Link: https://lore.kernel.org/r/1642646642-15908-1-git-send-email-shengjiu.wang@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-generic-dmaengine-pcm.c')
-rw-r--r--sound/soc/soc-generic-dmaengine-pcm.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
index c54c8ca8d715..8659cb1794f1 100644
--- a/sound/soc/soc-generic-dmaengine-pcm.c
+++ b/sound/soc/soc-generic-dmaengine-pcm.c
@@ -237,13 +237,15 @@ static int dmaengine_pcm_new(struct snd_soc_component *component,
size_t max_buffer_size;
unsigned int i;
- if (config && config->prealloc_buffer_size) {
+ if (config && config->prealloc_buffer_size)
prealloc_buffer_size = config->prealloc_buffer_size;
- max_buffer_size = config->pcm_hardware->buffer_bytes_max;
- } else {
+ else
prealloc_buffer_size = prealloc_buffer_size_kbytes * 1024;
+
+ if (config && config->pcm_hardware && config->pcm_hardware->buffer_bytes_max)
+ max_buffer_size = config->pcm_hardware->buffer_bytes_max;
+ else
max_buffer_size = SIZE_MAX;
- }
for_each_pcm_streams(i) {
struct snd_pcm_substream *substream = rtd->pcm->streams[i].substream;