Skip to content

Commit 726a589

Browse files
ISCAS-Vulabvijay-suman
authored andcommitted
ALSA: es1968: Add error handling for snd_pcm_hw_constraint_pow2()
commit 9e000f1b7f31684cc5927e034360b87ac7919593 upstream. 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: [email protected] # v2.6.22 Signed-off-by: Wentao Liang <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Takashi Iwai <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit 9a51bc522442133f0b8b7ecdb4bc5d74c20bc50e) Signed-off-by: Vijayendra Suman <[email protected]>
1 parent cfd1dac commit 726a589

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
@@ -1569,7 +1569,7 @@ static int snd_es1968_capture_open(struct snd_pcm_substream *substream)
15691569
struct snd_pcm_runtime *runtime = substream->runtime;
15701570
struct es1968 *chip = snd_pcm_substream_chip(substream);
15711571
struct esschan *es;
1572-
int apu1, apu2;
1572+
int err, apu1, apu2;
15731573

15741574
apu1 = snd_es1968_alloc_apu_pair(chip, ESM_APU_PCM_CAPTURE);
15751575
if (apu1 < 0)
@@ -1613,7 +1613,9 @@ static int snd_es1968_capture_open(struct snd_pcm_substream *substream)
16131613
runtime->hw = snd_es1968_capture;
16141614
runtime->hw.buffer_bytes_max = runtime->hw.period_bytes_max =
16151615
calc_available_memory_size(chip) - 1024; /* keep MIXBUF size */
1616-
snd_pcm_hw_constraint_pow2(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES);
1616+
err = snd_pcm_hw_constraint_pow2(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES);
1617+
if (err < 0)
1618+
return err;
16171619

16181620
spin_lock_irq(&chip->substream_lock);
16191621
list_add(&es->list, &chip->substream_list);

0 commit comments

Comments
 (0)