ALSA: compress: Set metadata_set only after successful callback
Subsystems (2)
PATCH 1/1 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.
--- sound/core/compress_offload.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/core/compress_offload.c +2 -2
@@ -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; }
Signature · 1 line
2.55.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] ALSA: compress: missing Fixes trailer for commit 9727b490e543 --
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 <[email protected]>
Quoted 10 lines
ALSA: compress: Set
metadata_setonly after successful callbackSet the
metadata_setflag only when the driver'sset_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.
Quoted 4 lines
Update the flag only when the callback returns zero so that its state accurately reflects successful metadata submission.
Signed-off-by Sreeraj S Kurup <[email protected]>
[Severity: Low]
Should this commit include a Fixes tag for the commit that introduced the unconditional assignment in snd_compr_set_metadata()?
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.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
PATCH v2 1/1 ALSA: compress: Set metadata_set only after successful callback
In reply to Sreeraj S KurupSet 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.
---
v2:
- Add Fixes trailer.
sound/core/compress_offload.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/core/compress_offload.c +2 -2
@@ -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; }
Signature · 1 line
2.55.0
Quoted 9 lines · Sreeraj S Kurup
Set the
metadata_setflag only when the driver'sset_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.
Quoted 5 lines
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 <[email protected]>
Applied now. Thanks.
Takashi
Hi,
Thanks for applying the patch!
Best regards,
Sreeraj