diff mbox series

[8/8] ASoC: soc-pcm: tidyup dulicate handing at dpcm_fe_dai_startup()

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

Commit Message

Kuninori Morimoto Feb. 26, 2020, 6:41 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

error handling at dpcm_fe_dai_startup() has duplicate code.
This patch tidyup it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-pcm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Pierre-Louis Bossart Feb. 26, 2020, 3:22 p.m. UTC | #1
On 2/26/20 12:41 AM, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> error handling at dpcm_fe_dai_startup() has duplicate code.
> This patch tidyup it.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>   sound/soc/soc-pcm.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
> index 1f7a86c4bc02..2fdd90437a6f 100644
> --- a/sound/soc/soc-pcm.c
> +++ b/sound/soc/soc-pcm.c
> @@ -2165,11 +2165,9 @@ static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream)
>   		goto unwind;
>   	}

nit-pick: since the two lines below are removed, the 'goto unwind' above 
becomes unnecessary. I don't mind if you leave it for symmetry with the 
rest of the error handling flow.

> -	dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
> -	return 0;
> -
>   unwind:
> -	dpcm_be_dai_startup_unwind(fe, stream);
> +	if (ret < 0)
> +		dpcm_be_dai_startup_unwind(fe, stream);
>   be_err:
>   	dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
>   	return ret;
>
Kuninori Morimoto Feb. 27, 2020, 12:04 a.m. UTC | #2
Hi Pierre-Louis

> > diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
> > index 1f7a86c4bc02..2fdd90437a6f 100644
> > --- a/sound/soc/soc-pcm.c
> > +++ b/sound/soc/soc-pcm.c
> > @@ -2165,11 +2165,9 @@ static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream)
> >   		goto unwind;
> >   	}
> 
> nit-pick: since the two lines below are removed, the 'goto unwind'
> above becomes unnecessary. I don't mind if you leave it for symmetry
> with the rest of the error handling flow.

Oops ? Indeed.
Thank you for your review
Will fixup it in v2

Thank you for your help !!
Best regards
---
Kuninori Morimoto
diff mbox series

Patch

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 1f7a86c4bc02..2fdd90437a6f 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -2165,11 +2165,9 @@  static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream)
 		goto unwind;
 	}
 
-	dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
-	return 0;
-
 unwind:
-	dpcm_be_dai_startup_unwind(fe, stream);
+	if (ret < 0)
+		dpcm_be_dai_startup_unwind(fe, stream);
 be_err:
 	dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
 	return ret;