summaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2022-03-21 16:18:26 +0100
committerTakashi Iwai <tiwai@suse.de>2022-03-21 16:18:34 +0100
commita6d4b685026cfe9837b07532db5d1e1681b5d129 (patch)
treeda872c8775a1ac87dc8122b1e1f9af19179dcb38 /sound/core
parentefb6402c3c4a7c26d97c92d70186424097b6e366 (diff)
parent8a580a26760cb14535c160613fe9cd0e4dc6f5c6 (diff)
downloadlinux-stable-a6d4b685026cfe9837b07532db5d1e1681b5d129.tar.gz
linux-stable-a6d4b685026cfe9837b07532db5d1e1681b5d129.tar.bz2
linux-stable-a6d4b685026cfe9837b07532db5d1e1681b5d129.zip
Merge branch 'for-next' into for-linus
Pull 5.18 development branch Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/Kconfig2
-rw-r--r--sound/core/oss/pcm_oss.c28
-rw-r--r--sound/core/seq/oss/seq_oss_init.c5
3 files changed, 18 insertions, 17 deletions
diff --git a/sound/core/Kconfig b/sound/core/Kconfig
index db2e3c63ff41..dd7b40734723 100644
--- a/sound/core/Kconfig
+++ b/sound/core/Kconfig
@@ -84,7 +84,7 @@ config SND_PCM_TIMER
help
If you disable this option, pcm timer will be unavailable, so
those stubs that use pcm timer (e.g. dmix, dsnoop & co) may work
- incorrectlly.
+ incorrectly.
For some embedded devices, we may disable it to reduce memory
footprint, about 20KB on x86_64 platform.
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index f158f0abd25d..90c3a367d7de 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -842,6 +842,17 @@ static void unlock_params(struct snd_pcm_runtime *runtime)
mutex_unlock(&runtime->oss.params_lock);
}
+static void snd_pcm_oss_release_buffers(struct snd_pcm_substream *substream)
+{
+ struct snd_pcm_runtime *runtime = substream->runtime;
+
+ kvfree(runtime->oss.buffer);
+ runtime->oss.buffer = NULL;
+#ifdef CONFIG_SND_PCM_OSS_PLUGINS
+ snd_pcm_oss_plugin_clear(substream);
+#endif
+}
+
/* call with params_lock held */
static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream)
{
@@ -972,12 +983,10 @@ static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream)
snd_pcm_oss_plugin_clear(substream);
if (!direct) {
/* add necessary plugins */
- snd_pcm_oss_plugin_clear(substream);
err = snd_pcm_plug_format_plugins(substream, params, sparams);
if (err < 0) {
pcm_dbg(substream->pcm,
"snd_pcm_plug_format_plugins failed: %i\n", err);
- snd_pcm_oss_plugin_clear(substream);
goto failure;
}
if (runtime->oss.plugin_first) {
@@ -986,7 +995,6 @@ static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream)
if (err < 0) {
pcm_dbg(substream->pcm,
"snd_pcm_plugin_build_io failed: %i\n", err);
- snd_pcm_oss_plugin_clear(substream);
goto failure;
}
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
@@ -994,10 +1002,8 @@ static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream)
} else {
err = snd_pcm_plugin_insert(plugin);
}
- if (err < 0) {
- snd_pcm_oss_plugin_clear(substream);
+ if (err < 0)
goto failure;
- }
}
}
#endif
@@ -1086,6 +1092,8 @@ static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream)
err = 0;
failure:
+ if (err)
+ snd_pcm_oss_release_buffers(substream);
kfree(sw_params);
kfree(params);
kfree(sparams);
@@ -2355,13 +2363,7 @@ static void snd_pcm_oss_look_for_setup(struct snd_pcm *pcm, int stream,
static void snd_pcm_oss_release_substream(struct snd_pcm_substream *substream)
{
- struct snd_pcm_runtime *runtime;
- runtime = substream->runtime;
- kvfree(runtime->oss.buffer);
- runtime->oss.buffer = NULL;
-#ifdef CONFIG_SND_PCM_OSS_PLUGINS
- snd_pcm_oss_plugin_clear(substream);
-#endif
+ snd_pcm_oss_release_buffers(substream);
substream->oss.oss = 0;
}
diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c
index 0ee4a5081fd6..42d4e7535a82 100644
--- a/sound/core/seq/oss/seq_oss_init.c
+++ b/sound/core/seq/oss/seq_oss_init.c
@@ -66,7 +66,7 @@ snd_seq_oss_create_client(void)
struct snd_seq_port_info *port;
struct snd_seq_port_callback port_callback;
- port = kmalloc(sizeof(*port), GFP_KERNEL);
+ port = kzalloc(sizeof(*port), GFP_KERNEL);
if (!port) {
rc = -ENOMEM;
goto __error;
@@ -80,8 +80,7 @@ snd_seq_oss_create_client(void)
system_client = rc;
- /* create annoucement receiver port */
- memset(port, 0, sizeof(*port));
+ /* create announcement receiver port */
strcpy(port->name, "Receiver");
port->addr.client = system_client;
port->capability = SNDRV_SEQ_PORT_CAP_WRITE; /* receive only */