LinuxTV Patchwork media: Drop superfluous PCM preallocation error checks

login
register
mail settings
Submitter Takashi Iwai
Date Feb. 6, 2019, 5:32 p.m.
Message ID <20190206173239.18046-1-tiwai@suse.de>
Download mbox | patch
Permalink /patch/54351/
State New
Delegated to: Hans Verkuil
Headers show

Comments

Takashi Iwai - Feb. 6, 2019, 5:32 p.m.
snd_pcm_lib_preallocate_pages() and co always succeed, so the error
check is simply redundant.  Drop it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---

This is a piece I overlooked in the previous patchset:
   https://www.spinics.net/lists/alsa-devel/msg87223.html

Media people, please give ACK if this is OK.  Then I'll merge it together
with other relevant patches.  Thanks!

 drivers/media/pci/solo6x10/solo6x10-g723.c | 4 +---
 drivers/media/pci/tw686x/tw686x-audio.c    | 3 ++-
 2 files changed, 3 insertions(+), 4 deletions(-)
Ezequiel Garcia - Feb. 6, 2019, 5:36 p.m.
On Wed, 6 Feb 2019 at 14:32, Takashi Iwai <tiwai@suse.de> wrote:
>
> snd_pcm_lib_preallocate_pages() and co always succeed, so the error
> check is simply redundant.  Drop it.
>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
>
> This is a piece I overlooked in the previous patchset:
>    https://www.spinics.net/lists/alsa-devel/msg87223.html
>
> Media people, please give ACK if this is OK.  Then I'll merge it together
> with other relevant patches.  Thanks!
>
>  drivers/media/pci/solo6x10/solo6x10-g723.c | 4 +---
>  drivers/media/pci/tw686x/tw686x-audio.c    | 3 ++-

tw686x changes look good.

Acked-by: Ezequiel Garcia <ezequiel@collabora.com>

Thanks,
Eze

>  2 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/pci/solo6x10/solo6x10-g723.c b/drivers/media/pci/solo6x10/solo6x10-g723.c
> index 2cc05a9d57ac..a16242a9206f 100644
> --- a/drivers/media/pci/solo6x10/solo6x10-g723.c
> +++ b/drivers/media/pci/solo6x10/solo6x10-g723.c
> @@ -360,13 +360,11 @@ static int solo_snd_pcm_init(struct solo_dev *solo_dev)
>              ss; ss = ss->next, i++)
>                 sprintf(ss->name, "Camera #%d Audio", i);
>
> -       ret = snd_pcm_lib_preallocate_pages_for_all(pcm,
> +       snd_pcm_lib_preallocate_pages_for_all(pcm,
>                                         SNDRV_DMA_TYPE_CONTINUOUS,
>                                         snd_dma_continuous_data(GFP_KERNEL),
>                                         G723_PERIOD_BYTES * PERIODS,
>                                         G723_PERIOD_BYTES * PERIODS);
> -       if (ret < 0)
> -               return ret;
>
>         solo_dev->snd_pcm = pcm;
>
> diff --git a/drivers/media/pci/tw686x/tw686x-audio.c b/drivers/media/pci/tw686x/tw686x-audio.c
> index a28329698e20..fb0e7573b5ae 100644
> --- a/drivers/media/pci/tw686x/tw686x-audio.c
> +++ b/drivers/media/pci/tw686x/tw686x-audio.c
> @@ -301,11 +301,12 @@ static int tw686x_snd_pcm_init(struct tw686x_dev *dev)
>              ss; ss = ss->next, i++)
>                 snprintf(ss->name, sizeof(ss->name), "vch%u audio", i);
>
> -       return snd_pcm_lib_preallocate_pages_for_all(pcm,
> +       snd_pcm_lib_preallocate_pages_for_all(pcm,
>                                 SNDRV_DMA_TYPE_DEV,
>                                 snd_dma_pci_data(dev->pci_dev),
>                                 TW686X_AUDIO_PAGE_MAX * AUDIO_DMA_SIZE_MAX,
>                                 TW686X_AUDIO_PAGE_MAX * AUDIO_DMA_SIZE_MAX);
> +       return 0;
>  }
>
>  static void tw686x_audio_dma_free(struct tw686x_dev *dev,
> --
> 2.16.4
>
Hans Verkuil - March 12, 2019, 8:13 a.m.
Hi Takashi,

On 2/6/19 6:32 PM, Takashi Iwai wrote:
> snd_pcm_lib_preallocate_pages() and co always succeed, so the error
> check is simply redundant.  Drop it.
> 
> Signed-off-by: Takashi Iwai <tiwai@suse.de>

Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

I can take it as for 5.2, but you can as well with my Ack. If you want me
to take it, let me know.

Regards,

	Hans

> ---
> 
> This is a piece I overlooked in the previous patchset:
>    https://www.spinics.net/lists/alsa-devel/msg87223.html
> 
> Media people, please give ACK if this is OK.  Then I'll merge it together
> with other relevant patches.  Thanks!
> 
>  drivers/media/pci/solo6x10/solo6x10-g723.c | 4 +---
>  drivers/media/pci/tw686x/tw686x-audio.c    | 3 ++-
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/pci/solo6x10/solo6x10-g723.c b/drivers/media/pci/solo6x10/solo6x10-g723.c
> index 2cc05a9d57ac..a16242a9206f 100644
> --- a/drivers/media/pci/solo6x10/solo6x10-g723.c
> +++ b/drivers/media/pci/solo6x10/solo6x10-g723.c
> @@ -360,13 +360,11 @@ static int solo_snd_pcm_init(struct solo_dev *solo_dev)
>  	     ss; ss = ss->next, i++)
>  		sprintf(ss->name, "Camera #%d Audio", i);
>  
> -	ret = snd_pcm_lib_preallocate_pages_for_all(pcm,
> +	snd_pcm_lib_preallocate_pages_for_all(pcm,
>  					SNDRV_DMA_TYPE_CONTINUOUS,
>  					snd_dma_continuous_data(GFP_KERNEL),
>  					G723_PERIOD_BYTES * PERIODS,
>  					G723_PERIOD_BYTES * PERIODS);
> -	if (ret < 0)
> -		return ret;
>  
>  	solo_dev->snd_pcm = pcm;
>  
> diff --git a/drivers/media/pci/tw686x/tw686x-audio.c b/drivers/media/pci/tw686x/tw686x-audio.c
> index a28329698e20..fb0e7573b5ae 100644
> --- a/drivers/media/pci/tw686x/tw686x-audio.c
> +++ b/drivers/media/pci/tw686x/tw686x-audio.c
> @@ -301,11 +301,12 @@ static int tw686x_snd_pcm_init(struct tw686x_dev *dev)
>  	     ss; ss = ss->next, i++)
>  		snprintf(ss->name, sizeof(ss->name), "vch%u audio", i);
>  
> -	return snd_pcm_lib_preallocate_pages_for_all(pcm,
> +	snd_pcm_lib_preallocate_pages_for_all(pcm,
>  				SNDRV_DMA_TYPE_DEV,
>  				snd_dma_pci_data(dev->pci_dev),
>  				TW686X_AUDIO_PAGE_MAX * AUDIO_DMA_SIZE_MAX,
>  				TW686X_AUDIO_PAGE_MAX * AUDIO_DMA_SIZE_MAX);
> +	return 0;
>  }
>  
>  static void tw686x_audio_dma_free(struct tw686x_dev *dev,
>

Patch

diff --git a/drivers/media/pci/solo6x10/solo6x10-g723.c b/drivers/media/pci/solo6x10/solo6x10-g723.c
index 2cc05a9d57ac..a16242a9206f 100644
--- a/drivers/media/pci/solo6x10/solo6x10-g723.c
+++ b/drivers/media/pci/solo6x10/solo6x10-g723.c
@@ -360,13 +360,11 @@  static int solo_snd_pcm_init(struct solo_dev *solo_dev)
 	     ss; ss = ss->next, i++)
 		sprintf(ss->name, "Camera #%d Audio", i);
 
-	ret = snd_pcm_lib_preallocate_pages_for_all(pcm,
+	snd_pcm_lib_preallocate_pages_for_all(pcm,
 					SNDRV_DMA_TYPE_CONTINUOUS,
 					snd_dma_continuous_data(GFP_KERNEL),
 					G723_PERIOD_BYTES * PERIODS,
 					G723_PERIOD_BYTES * PERIODS);
-	if (ret < 0)
-		return ret;
 
 	solo_dev->snd_pcm = pcm;
 
diff --git a/drivers/media/pci/tw686x/tw686x-audio.c b/drivers/media/pci/tw686x/tw686x-audio.c
index a28329698e20..fb0e7573b5ae 100644
--- a/drivers/media/pci/tw686x/tw686x-audio.c
+++ b/drivers/media/pci/tw686x/tw686x-audio.c
@@ -301,11 +301,12 @@  static int tw686x_snd_pcm_init(struct tw686x_dev *dev)
 	     ss; ss = ss->next, i++)
 		snprintf(ss->name, sizeof(ss->name), "vch%u audio", i);
 
-	return snd_pcm_lib_preallocate_pages_for_all(pcm,
+	snd_pcm_lib_preallocate_pages_for_all(pcm,
 				SNDRV_DMA_TYPE_DEV,
 				snd_dma_pci_data(dev->pci_dev),
 				TW686X_AUDIO_PAGE_MAX * AUDIO_DMA_SIZE_MAX,
 				TW686X_AUDIO_PAGE_MAX * AUDIO_DMA_SIZE_MAX);
+	return 0;
 }
 
 static void tw686x_audio_dma_free(struct tw686x_dev *dev,

Privacy Policy