All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: compress: Set metadata_set only after successful callback
@ 2026-11-13  9:11 Sreeraj S Kurup
  2026-11-13  9:17 ` sashiko-bot
  2026-11-13  9:25 ` [PATCH v2] " Sreeraj S Kurup
  0 siblings, 2 replies; 3+ messages in thread
From: Sreeraj S Kurup @ 2026-11-13  9:11 UTC (permalink / raw)
  To: tiwai, perex; +Cc: linux-kernel, linux-sound, Sreeraj S Kurup

Set the metadata_set flag only when the driver's set_metadata()
callback completes successfully.

Previously, the flag was set even when the callback returned an
error. This incorrectly indicated that metadata had been applied
successfully, potentially causing later operations to skip metadata
setup.

Update the flag only when the callback returns zero so that its
state accurately reflects successful metadata submission.

Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
---
 sound/core/compress_offload.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index 5e5e0f78f26d..9b53282e0192 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -796,8 +796,8 @@ snd_compr_set_metadata(struct snd_compr_stream *stream, unsigned long arg)
 		return -EFAULT;
 
 	retval = stream->ops->set_metadata(stream, &metadata);
-	stream->metadata_set = true;
-
+	if (!retval)
+		stream->metadata_set = true;
 	return retval;
 }
 
-- 
2.55.0


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

* Re: [PATCH] ALSA: compress: Set metadata_set only after successful callback
  2026-11-13  9:11 [PATCH] ALSA: compress: Set metadata_set only after successful callback Sreeraj S Kurup
@ 2026-11-13  9:17 ` sashiko-bot
  2026-11-13  9:25 ` [PATCH v2] " Sreeraj S Kurup
  1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-11-13  9:17 UTC (permalink / raw)
  To: Sreeraj S Kurup; +Cc: linux-sound

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] ALSA: compress: missing Fixes trailer for commit 9727b490e543
--

commit 965fa8b5eac2d0c56694f06c6f1691a5d9ac92a3
Author: Sreeraj S Kurup <sreekuttan2156239@gmail.com>

> ALSA: compress: Set metadata_set only after successful callback
>
> Set the metadata_set flag only when the driver's set_metadata()
> callback completes successfully.
>
> Previously, the flag was set even when the callback returned an
> error. This incorrectly indicated that metadata had been applied
> successfully, potentially causing later operations to skip metadata
> setup.
>
> Update the flag only when the callback returns zero so that its
> state accurately reflects successful metadata submission.
>
> Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>

[Severity: Low]
Should this commit include a Fixes tag for the commit that introduced the
unconditional assignment in snd_compr_set_metadata()?

  Fixes: 9727b490e543 ("ALSA: compress: add support for gapless playback")

Also, this isn't a bug in the patch, but stream->metadata_set is only read
in snd_compr_next_track() to gate SNDRV_COMPRESS_NEXT_TRACK (returning
-EPERM when false), rather than causing later operations to skip metadata
setup.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261113091159.2954-1-sreekuttan2156239@gmail.com?part=1

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

* [PATCH v2] ALSA: compress: Set metadata_set only after successful callback
  2026-11-13  9:11 [PATCH] ALSA: compress: Set metadata_set only after successful callback Sreeraj S Kurup
  2026-11-13  9:17 ` sashiko-bot
@ 2026-11-13  9:25 ` Sreeraj S Kurup
  1 sibling, 0 replies; 3+ messages in thread
From: Sreeraj S Kurup @ 2026-11-13  9:25 UTC (permalink / raw)
  To: sreekuttan2156239; +Cc: linux-kernel, linux-sound, perex, tiwai

Set the metadata_set flag only when the driver's set_metadata()
callback completes successfully.

Previously, the flag was set even when the callback returned an
error. This incorrectly indicated that metadata had been applied
successfully, potentially causing later operations to skip metadata
setup.

Update the flag only when the callback returns zero so that its
state accurately reflects successful metadata submission.

Fixes: 9727b490e543 ("ALSA: compress: add support for gapless playback")
Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
---
v2:
 - Add Fixes trailer.

 sound/core/compress_offload.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index 5e5e0f78f26d..9b53282e0192 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -796,8 +796,8 @@ snd_compr_set_metadata(struct snd_compr_stream *stream, unsigned long arg)
 		return -EFAULT;
 
 	retval = stream->ops->set_metadata(stream, &metadata);
-	stream->metadata_set = true;
-
+	if (!retval)
+		stream->metadata_set = true;
 	return retval;
 }
 
-- 
2.55.0


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

end of thread, other threads:[~2026-11-13  9:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-13  9:11 [PATCH] ALSA: compress: Set metadata_set only after successful callback Sreeraj S Kurup
2026-11-13  9:17 ` sashiko-bot
2026-11-13  9:25 ` [PATCH v2] " Sreeraj S Kurup

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.