mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda: trace PCM open only after assigning a stream
@ 2026-09-13 12:51 Slavin Liu
  2026-09-14 16:10 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Slavin Liu @ 2026-09-13 12:51 UTC (permalink / raw)
  To: perex, tiwai; +Cc: linux-sound, linux-kernel, bolin.liu

Stream assignment can fail when hardware streams are exhausted.
Move the tracepoint after the NULL check because its payload accesses
the assigned stream tag.

Detected by static analysis and reviewed with AI-assisted source auditing.

Fixes: 184865085b88 ("ALSA: hda - rename hda_intel_trace.h to hda_controller_trace.h")
Assisted-by: LLM
Signed-off-by: Slavin Liu <bolin.liu@seu.edu.cn>
---
 sound/hda/common/controller.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/hda/common/controller.c b/sound/hda/common/controller.c
index afec5c5546ec..18dae022b324 100644
--- a/sound/hda/common/controller.c
+++ b/sound/hda/common/controller.c
@@ -586,11 +586,11 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
 	snd_hda_codec_pcm_get(apcm->info);
 	mutex_lock(&chip->open_mutex);
 	azx_dev = azx_assign_device(chip, substream);
-	trace_azx_pcm_open(chip, azx_dev);
 	if (azx_dev == NULL) {
 		err = -EBUSY;
 		goto unlock;
 	}
+	trace_azx_pcm_open(chip, azx_dev);
 	runtime->private_data = azx_dev;
 
 	runtime->hw = azx_pcm_hw;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ALSA: hda: trace PCM open only after assigning a stream
  2026-09-13 12:51 [PATCH] ALSA: hda: trace PCM open only after assigning a stream Slavin Liu
@ 2026-09-14 16:10 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2026-09-14 16:10 UTC (permalink / raw)
  To: Slavin Liu; +Cc: perex, tiwai, linux-sound, linux-kernel

On Sun, 13 Sep 2026 14:51:54 +0200,
Slavin Liu wrote:
> 
> Stream assignment can fail when hardware streams are exhausted.
> Move the tracepoint after the NULL check because its payload accesses
> the assigned stream tag.
> 
> Detected by static analysis and reviewed with AI-assisted source auditing.
> 
> Fixes: 184865085b88 ("ALSA: hda - rename hda_intel_trace.h to hda_controller_trace.h")
> Assisted-by: LLM
> Signed-off-by: Slavin Liu <bolin.liu@seu.edu.cn>

Applied now.

I think I wanted to track the error state, too, and that's likely the
reason the code was put there.  But, judging from the current code,
better to move as in this patch in the end.


thanks,

Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-14 16:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-13 12:51 [PATCH] ALSA: hda: trace PCM open only after assigning a stream Slavin Liu
2026-09-14 16:10 ` 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®