All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ALSA: wss: Fix invalid snd_free_pages() at error path
@ 2018-11-23 17:19 Takashi Iwai
  2018-11-23 17:19 ` [PATCH 2/2] ALSA: sparc: " Takashi Iwai
  2018-11-24 14:40 ` [PATCH 1/2] ALSA: wss: " Takashi Sakamoto
  0 siblings, 2 replies; 4+ messages in thread
From: Takashi Iwai @ 2018-11-23 17:19 UTC (permalink / raw)
  To: alsa-devel

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@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 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;
-- 
2.19.1

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

* [PATCH 2/2] ALSA: sparc: Fix invalid snd_free_pages() at error path
  2018-11-23 17:19 [PATCH 1/2] ALSA: wss: Fix invalid snd_free_pages() at error path Takashi Iwai
@ 2018-11-23 17:19 ` Takashi Iwai
  2018-11-24 14:47   ` [alsa-devel] " Takashi Sakamoto
  2018-11-24 14:40 ` [PATCH 1/2] ALSA: wss: " Takashi Sakamoto
  1 sibling, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2018-11-23 17:19 UTC (permalink / raw)
  To: alsa-devel

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.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/sparc/cs4231.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
index e73c962590eb..079063d8038d 100644
--- a/sound/sparc/cs4231.c
+++ b/sound/sparc/cs4231.c
@@ -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);
@@ -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);
-- 
2.19.1

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

* Re: [PATCH 1/2] ALSA: wss: Fix invalid snd_free_pages() at error path
  2018-11-23 17:19 [PATCH 1/2] ALSA: wss: Fix invalid snd_free_pages() at error path Takashi Iwai
  2018-11-23 17:19 ` [PATCH 2/2] ALSA: sparc: " Takashi Iwai
@ 2018-11-24 14:40 ` Takashi Sakamoto
  1 sibling, 0 replies; 4+ messages in thread
From: Takashi Sakamoto @ 2018-11-24 14:40 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

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@vger.kernel.org>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
>  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@sakamocchi.jp>

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@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [alsa-devel] [PATCH 2/2] ALSA: sparc: Fix invalid snd_free_pages() at error path
  2018-11-23 17:19 ` [PATCH 2/2] ALSA: sparc: " Takashi Iwai
@ 2018-11-24 14:47   ` Takashi Sakamoto
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Sakamoto @ 2018-11-24 14:47 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel, stable

On Fri, Nov 23, 2018 at 06:19:56PM +0100, Takashi Iwai wrote:
> 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.
> 
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
>  sound/sparc/cs4231.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
> index e73c962590eb..079063d8038d 100644
> --- a/sound/sparc/cs4231.c
> +++ b/sound/sparc/cs4231.c
> @@ -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);
> @@ -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);
> -- 
> 2.19.1

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

Regards

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

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

end of thread, other threads:[~2018-11-25  1:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-23 17:19 [PATCH 1/2] ALSA: wss: Fix invalid snd_free_pages() at error path Takashi Iwai
2018-11-23 17:19 ` [PATCH 2/2] ALSA: sparc: " Takashi Iwai
2018-11-24 14:47   ` [alsa-devel] " Takashi Sakamoto
2018-11-24 14:40 ` [PATCH 1/2] ALSA: wss: " Takashi Sakamoto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.