Skip to contentSkip to conversation

ALSA: pcm: Propagate snd_pcm_stop() errors in snd_pcm_drop()

PATCH Applied [email protected] 2 participants 2 messages Sep 16 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: pcm: Propagate snd_pcm_stop() errors in snd_pcm_drop()

From: bui duc phuc <[email protected]>

snd_pcm_drop() currently ignores the return value of snd_pcm_stop() and returns a pre-initialized zero instead.

Store the return value of snd_pcm_stop() in 'result' so that any error is propagated to the caller.

Found by manual code inspection.

---
 sound/core/pcm_native.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/core/pcm_native.c +2 -2
index 000e926a1e6a..74054b9ca712 100644
@@ -2267,7 +2267,7 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream,
 static int snd_pcm_drop(struct snd_pcm_substream *substream)
 {
 	struct snd_pcm_runtime *runtime;
-	int result = 0;
+	int result;
 	
 	if (PCM_RUNTIME_CHECK(substream))
 		return -ENXIO;
@@ -2282,7 +2282,7 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream)
 	if (runtime->state == SNDRV_PCM_STATE_PAUSED)
 		snd_pcm_pause(substream, false);
 
-	snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP);
+	result = snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP);
 	/* runtime->control->appl_ptr = runtime->status->hw_ptr; */
 
 	return result;
Signature · 1 line
2.43.0
Applied
#1 lore raw
Quoted 6 lines · On Wed, 16 Sep 2026 11:40:14 +0200, [email protected] wrote:

From: bui duc phuc <[email protected]>

snd_pcm_drop() currently ignores the return value of snd_pcm_stop() and returns a pre-initialized zero instead.

Quoted 6 lines

Store the return value of snd_pcm_stop() in 'result' so that any error is propagated to the caller.

Found by manual code inspection.

Applied to for-next branch. Thanks.

Takashi