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

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.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Link: https://patch.msgid.link/20260916094014.33609-1-phucduc.bui@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
bui duc phuc 2026-09-16 16:40:14 +07:00 committed by Takashi Iwai
parent ad563e61f5
commit c1d6580f70

View File

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