FROMGIT: 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>

Bug: 226635564
(cherry picked from commit 88c62b1628
 https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next)
Change-Id: Ib5c5540afcb79665bb0daf684954365747439ad8
Signed-off-by: Zhipeng Wang <zhipeng.wang_1@nxp.com>
This commit is contained in:
Shengjiu Wang
2022-01-20 10:44:02 +08:00
committed by Todd Kjos
parent cd54a8bad4
commit 754bb029c8

View File

@@ -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;