summaryrefslogtreecommitdiff
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2021-07-14 19:24:24 +0300
committerTakashi Iwai <tiwai@suse.de>2021-07-15 11:22:38 +0300
commit2c4e3154571612c419cb0c4e86ea0afd5be83da0 (patch)
treecd84a9169a07579318050f23f49bebec63f6eca8 /sound/core
parentfc93c96fe34e10b873fef73e80cee52503f3a679 (diff)
downloadlinux-2c4e3154571612c419cb0c4e86ea0afd5be83da0.tar.xz
ALSA: compress: Initialize mutex in snd_compress_new()
Currently the snd_compr.lock mutex isn't initialized in the API functions although the lock is used many places in other code in compress offload API. It's because the object was expected to be initialized via snd_compress_register(), but this was never used by ASoC, which is the only user. Instead, ASoC initializes the mutex by itself, and this is error-prone. This patch moves the mutex initialization into the more appropriate place, snd_compress_new(), for avoiding the missing init. Reviewed-by: Mark Brown <broonie@kernel.org> Acked-by: Vinod Koul <vkoul@kernel.org> Reviewed-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20210714162424.4412-3-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/compress_offload.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index ed5546ae300a..de514ec8c83d 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -1177,6 +1177,7 @@ int snd_compress_new(struct snd_card *card, int device,
compr->card = card;
compr->device = device;
compr->direction = dirn;
+ mutex_init(&compr->lock);
snd_compress_set_id(compr, id);