public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: es1968: Add error handling for snd_pcm_hw_constraint_pow2()
@ 2025-05-14  9:24 Wentao Liang
  2025-05-14 10:14 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2025-05-14  9:24 UTC (permalink / raw)
  To: perex, tiwai; +Cc: linux-sound, linux-kernel, Wentao Liang, stable

The function snd_es1968_capture_open() calls the function
snd_pcm_hw_constraint_pow2(), but does not check its return
value. A proper implementation can be found in snd_cx25821_pcm_open().

Add error handling for snd_pcm_hw_constraint_pow2() and propagate its
error code.

Fixes: b942cf815b57 ("[ALSA] es1968 - Fix stuttering capture")
Cc: stable@vger.kernel.org # v2.6.22
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 sound/pci/es1968.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index c6c018b40c69..4e0693f0ab0f 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -1561,7 +1561,7 @@ static int snd_es1968_capture_open(struct snd_pcm_substream *substream)
 	struct snd_pcm_runtime *runtime = substream->runtime;
 	struct es1968 *chip = snd_pcm_substream_chip(substream);
 	struct esschan *es;
-	int apu1, apu2;
+	int err, apu1, apu2;
 
 	apu1 = snd_es1968_alloc_apu_pair(chip, ESM_APU_PCM_CAPTURE);
 	if (apu1 < 0)
@@ -1605,7 +1605,9 @@ static int snd_es1968_capture_open(struct snd_pcm_substream *substream)
 	runtime->hw = snd_es1968_capture;
 	runtime->hw.buffer_bytes_max = runtime->hw.period_bytes_max =
 		calc_available_memory_size(chip) - 1024; /* keep MIXBUF size */
-	snd_pcm_hw_constraint_pow2(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES);
+	err = snd_pcm_hw_constraint_pow2(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES);
+	if (err < 0)
+		return err;
 
 	spin_lock_irq(&chip->substream_lock);
 	list_add(&es->list, &chip->substream_list);
-- 
2.42.0.windows.2


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

* Re: [PATCH] ALSA: es1968: Add error handling for snd_pcm_hw_constraint_pow2()
  2025-05-14  9:24 [PATCH] ALSA: es1968: Add error handling for snd_pcm_hw_constraint_pow2() Wentao Liang
@ 2025-05-14 10:14 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2025-05-14 10:14 UTC (permalink / raw)
  To: Wentao Liang; +Cc: perex, tiwai, linux-sound, linux-kernel, stable

On Wed, 14 May 2025 11:24:44 +0200,
Wentao Liang wrote:
> 
> The function snd_es1968_capture_open() calls the function
> snd_pcm_hw_constraint_pow2(), but does not check its return
> value. A proper implementation can be found in snd_cx25821_pcm_open().
> 
> Add error handling for snd_pcm_hw_constraint_pow2() and propagate its
> error code.
> 
> Fixes: b942cf815b57 ("[ALSA] es1968 - Fix stuttering capture")
> Cc: stable@vger.kernel.org # v2.6.22
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>

Thanks, applied now.


Takashi

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

end of thread, other threads:[~2025-05-14 10:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-14  9:24 [PATCH] ALSA: es1968: Add error handling for snd_pcm_hw_constraint_pow2() Wentao Liang
2025-05-14 10:14 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox