Skip to content

Commit 9e000f1

Browse files
ISCAS-Vulabtiwai
authored andcommitted
ALSA: es1968: Add error handling for snd_pcm_hw_constraint_pow2()
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: b942cf8 ("[ALSA] es1968 - Fix stuttering capture") Cc: stable@vger.kernel.org # v2.6.22 Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> Link: https://patch.msgid.link/20250514092444.331-1-vulab@iscas.ac.cn Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 66e48ef commit 9e000f1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sound/pci/es1968.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,7 +1561,7 @@ static int snd_es1968_capture_open(struct snd_pcm_substream *substream)
15611561
struct snd_pcm_runtime *runtime = substream->runtime;
15621562
struct es1968 *chip = snd_pcm_substream_chip(substream);
15631563
struct esschan *es;
1564-
int apu1, apu2;
1564+
int err, apu1, apu2;
15651565

15661566
apu1 = snd_es1968_alloc_apu_pair(chip, ESM_APU_PCM_CAPTURE);
15671567
if (apu1 < 0)
@@ -1605,7 +1605,9 @@ static int snd_es1968_capture_open(struct snd_pcm_substream *substream)
16051605
runtime->hw = snd_es1968_capture;
16061606
runtime->hw.buffer_bytes_max = runtime->hw.period_bytes_max =
16071607
calc_available_memory_size(chip) - 1024; /* keep MIXBUF size */
1608-
snd_pcm_hw_constraint_pow2(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES);
1608+
err = snd_pcm_hw_constraint_pow2(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES);
1609+
if (err < 0)
1610+
return err;
16091611

16101612
spin_lock_irq(&chip->substream_lock);
16111613
list_add(&es->list, &chip->substream_list);

0 commit comments

Comments
 (0)