From: Takashi Iwai Subject: Re: [PATCH] pcm_plug: Clear plugins on all error conditions Date: Wed, 19 Oct 2016 22:00:00 +0200 Message-ID: References: <1476857428-13660-1-git-send-email-mforney@mforney.org> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id F0FC2266FC0 for ; Wed, 19 Oct 2016 22:00:01 +0200 (CEST) In-Reply-To: <1476857428-13660-1-git-send-email-mforney@mforney.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Michael Forney Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org On Wed, 19 Oct 2016 08:10:28 +0200, Michael Forney wrote: > > Otherwise, they will linger after the error is returned (but pcm->setup == 0). > Then, if the caller tries to clean up and call snd_pcm_close(), the assertion > plug->gen.slave == plug->req_slave will fail. The changes look OK, but could you give your sign-off? thanks, Takashi > --- > src/pcm/pcm_plug.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/src/pcm/pcm_plug.c b/src/pcm/pcm_plug.c > index 5639b9e..266707b 100644 > --- a/src/pcm/pcm_plug.c > +++ b/src/pcm/pcm_plug.c > @@ -652,8 +652,10 @@ static int snd_pcm_plug_insert_plugins(snd_pcm_t *pcm, > (plug->ttable && !plug->ttable_ok)) { > snd_pcm_t *new; > int err; > - if (k >= sizeof(funcs)/sizeof(*funcs)) > + if (k >= sizeof(funcs)/sizeof(*funcs)) { > + snd_pcm_plug_clear(pcm); > return -EINVAL; > + } > err = funcs[k](pcm, &new, client, &p); > if (err < 0) { > snd_pcm_plug_clear(pcm); > -- > 2.10.1 >