diff mbox series

[v3,18/18] ALSA: usx2y: use for_each_pcm_streams() macro

Message ID 87lfp29cvq.wl-kuninori.morimoto.gx@renesas.com (mailing list archive)
State New, archived
Headers show
Series ASoC: soc-pcm cleanup step3 | expand

Commit Message

Kuninori Morimoto Feb. 17, 2020, 2:16 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
---
 sound/usb/usx2y/usbusx2yaudio.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Takashi Iwai Feb. 17, 2020, 7:55 a.m. UTC | #1
On Mon, 17 Feb 2020 03:16:59 +0100,
Kuninori Morimoto wrote:
> 
> 
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>

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


thanks,

Takashi

> ---
>  sound/usb/usx2y/usbusx2yaudio.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c
> index 772f6f3ccbb1..37d290fe9d43 100644
> --- a/sound/usb/usx2y/usbusx2yaudio.c
> +++ b/sound/usb/usx2y/usbusx2yaudio.c
> @@ -906,11 +906,12 @@ static const struct snd_pcm_ops snd_usX2Y_pcm_ops =
>   */
>  static void usX2Y_audio_stream_free(struct snd_usX2Y_substream **usX2Y_substream)
>  {
> -	kfree(usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK]);
> -	usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK] = NULL;
> +	int stream;
>  
> -	kfree(usX2Y_substream[SNDRV_PCM_STREAM_CAPTURE]);
> -	usX2Y_substream[SNDRV_PCM_STREAM_CAPTURE] = NULL;
> +	for_each_pcm_streams(stream) {
> +		kfree(usX2Y_substream[stream]);
> +		usX2Y_substream[stream] = NULL;
> +	}
>  }
>  
>  static void snd_usX2Y_pcm_private_free(struct snd_pcm *pcm)
> -- 
> 2.17.1
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
diff mbox series

Patch

diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c
index 772f6f3ccbb1..37d290fe9d43 100644
--- a/sound/usb/usx2y/usbusx2yaudio.c
+++ b/sound/usb/usx2y/usbusx2yaudio.c
@@ -906,11 +906,12 @@  static const struct snd_pcm_ops snd_usX2Y_pcm_ops =
  */
 static void usX2Y_audio_stream_free(struct snd_usX2Y_substream **usX2Y_substream)
 {
-	kfree(usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK]);
-	usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK] = NULL;
+	int stream;
 
-	kfree(usX2Y_substream[SNDRV_PCM_STREAM_CAPTURE]);
-	usX2Y_substream[SNDRV_PCM_STREAM_CAPTURE] = NULL;
+	for_each_pcm_streams(stream) {
+		kfree(usX2Y_substream[stream]);
+		usX2Y_substream[stream] = NULL;
+	}
 }
 
 static void snd_usX2Y_pcm_private_free(struct snd_pcm *pcm)