Re: [PATCH 1/2] ALSA: wss: Fix invalid snd_free_pages() at error path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Fri, Nov 23, 2018 at 06:19:55PM +0100, Takashi Iwai wrote:
> Some spurious calls of snd_free_pages() have been overlooked and
> remain in the error paths of wss driver code.  Since runtime->dma_area
> is managed by the PCM core helper, we shouldn't release manually.
> 
> Drop the superfluous calls.
> 
> Cc: <stable@xxxxxxxxxxxxxxx>
> Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
> ---
>  sound/isa/wss/wss_lib.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c
> index 32453f81b95a..3a5008837576 100644
> --- a/sound/isa/wss/wss_lib.c
> +++ b/sound/isa/wss/wss_lib.c
> @@ -1531,7 +1531,6 @@ static int snd_wss_playback_open(struct snd_pcm_substream *substream)
>  	if (err < 0) {
>  		if (chip->release_dma)
>  			chip->release_dma(chip, chip->dma_private_data, chip->dma1);
> -		snd_free_pages(runtime->dma_area, runtime->dma_bytes);
>  		return err;
>  	}
>  	chip->playback_substream = substream;
> @@ -1572,7 +1571,6 @@ static int snd_wss_capture_open(struct snd_pcm_substream *substream)
>  	if (err < 0) {
>  		if (chip->release_dma)
>  			chip->release_dma(chip, chip->dma_private_data, chip->dma2);
> -		snd_free_pages(runtime->dma_area, runtime->dma_bytes);
>  		return err;
>  	}
>  	chip->capture_substream = substream;

Reviewed-by: Takashi Sakamoto <o-takashi@xxxxxxxxxxxxx>

As in commit message, in this case, the 'struct snd_pcm_runtime.dma_area'
is assigned by a call of 'snd_pcm_lib_malloc_pages()', thus it's
allocated in 'snd_wss_[capture|playback]_hw_params()', and released in
'snd_wss_[capture|playback]_hw_free()'. No need to care it in
'snd_wss_[capture|playback_open()]'.

> -- 
> 2.19.1
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@xxxxxxxxxxxxxxxx
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux