Skip to content

Commit

Permalink
ALSA: sparc: Fix invalid snd_free_pages() at error path
Browse files Browse the repository at this point in the history
Some spurious calls of snd_free_pages() have been overlooked and
remain in the error paths of sparc cs4231 driver code.  Since
runtime->dma_area is managed by the PCM core helper, we shouldn't
release manually.

Drop the superfluous calls.

Reviewed-by: Takashi Sakamoto <[email protected]>
Cc: <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
tiwai committed Nov 24, 2018
1 parent 7b69154 commit 9a20332
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions sound/sparc/cs4231.c
Original file line number Diff line number Diff line change
Expand Up @@ -1146,10 +1146,8 @@ static int snd_cs4231_playback_open(struct snd_pcm_substream *substream)
runtime->hw = snd_cs4231_playback;

err = snd_cs4231_open(chip, CS4231_MODE_PLAY);
if (err < 0) {
snd_free_pages(runtime->dma_area, runtime->dma_bytes);
if (err < 0)
return err;
}
chip->playback_substream = substream;
chip->p_periods_sent = 0;
snd_pcm_set_sync(substream);
Expand All @@ -1167,10 +1165,8 @@ static int snd_cs4231_capture_open(struct snd_pcm_substream *substream)
runtime->hw = snd_cs4231_capture;

err = snd_cs4231_open(chip, CS4231_MODE_RECORD);
if (err < 0) {
snd_free_pages(runtime->dma_area, runtime->dma_bytes);
if (err < 0)
return err;
}
chip->capture_substream = substream;
chip->c_periods_sent = 0;
snd_pcm_set_sync(substream);
Expand Down

0 comments on commit 9a20332

Please sign in to comment.