Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751455AbdISGLC (ORCPT ); Tue, 19 Sep 2017 02:11:02 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:56200 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750974AbdISGLA (ORCPT ); Tue, 19 Sep 2017 02:11:00 -0400 Subject: Re: [PATCH] ASoC: davinci-mcasp: Fix an error handling path in 'davinci_mcasp_probe()' To: Christophe JAILLET , , , , References: <20170916054029.27804-1-christophe.jaillet@wanadoo.fr> CC: , , From: Peter Ujfalusi Message-ID: <5c531501-ecb9-3a04-fc67-ca3dabaff5bf@ti.com> Date: Tue, 19 Sep 2017 09:10:16 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170916054029.27804-1-christophe.jaillet@wanadoo.fr> Content-Type: text/plain; charset="utf-8" X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v8J6B8Cs026063 Content-Length: 1390 Lines: 41  Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki On 2017-09-16 08:40, Christophe JAILLET wrote: > All error handling paths in this function 'goto err' except this one. > > If one of the 2 previous memory allocations fails, we should go through > the existing error handling path. Otherwise there is an unbalanced > pm_runtime_enable()/pm_runtime_disable(). Acked-by: Peter Ujfalusi > Fixes: dd55ff8346a9 ("ASoC: davinci-mcasp: Add set_tdm_slots() support") > Signed-off-by: Christophe JAILLET > --- > sound/soc/davinci/davinci-mcasp.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c > index f395bbc7c354..23b0da7df1f2 100644 > --- a/sound/soc/davinci/davinci-mcasp.c > +++ b/sound/soc/davinci/davinci-mcasp.c > @@ -1982,8 +1982,10 @@ static int davinci_mcasp_probe(struct platform_device *pdev) > GFP_KERNEL); > > if (!mcasp->chconstr[SNDRV_PCM_STREAM_PLAYBACK].list || > - !mcasp->chconstr[SNDRV_PCM_STREAM_CAPTURE].list) > - return -ENOMEM; > + !mcasp->chconstr[SNDRV_PCM_STREAM_CAPTURE].list) { > + ret = -ENOMEM; > + goto err; > + } > > ret = davinci_mcasp_set_ch_constraints(mcasp); > if (ret) > - Péter