* [PATCH] ALSA: pcm: Propagate snd_pcm_stop() errors in snd_pcm_drop()
@ 2026-09-16 9:40 phucduc.bui
2026-09-16 12:07 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: phucduc.bui @ 2026-09-16 9:40 UTC (permalink / raw)
To: Jaroslav Kysela, Takashi Iwai, cassiogabrielcontato, Cezary Rojewski
Cc: Cen Zhang, Yilin Zhang, linux-sound, linux-kernel, bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
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>
---
sound/core/pcm_native.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 000e926a1e6a..74054b9ca712 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -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;
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ALSA: pcm: Propagate snd_pcm_stop() errors in snd_pcm_drop()
2026-09-16 9:40 [PATCH] ALSA: pcm: Propagate snd_pcm_stop() errors in snd_pcm_drop() phucduc.bui
@ 2026-09-16 12:07 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2026-09-16 12:07 UTC (permalink / raw)
To: phucduc.bui
Cc: Jaroslav Kysela, Takashi Iwai, cassiogabrielcontato,
Cezary Rojewski, Cen Zhang, Yilin Zhang, linux-sound,
linux-kernel
On Wed, 16 Sep 2026 11:40:14 +0200,
phucduc.bui@gmail.com wrote:
>
> From: bui duc phuc <phucduc.bui@gmail.com>
>
> 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>
Applied to for-next branch. Thanks.
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-16 12:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16 9:40 [PATCH] ALSA: pcm: Propagate snd_pcm_stop() errors in snd_pcm_drop() phucduc.bui
2026-09-16 12:07 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®