From patchwork Thu Feb 22 19:02:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 10236145 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 927DB602DC for ; Thu, 22 Feb 2018 19:02:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8DA0E28C8D for ; Thu, 22 Feb 2018 19:02:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81DCC28C8F; Thu, 22 Feb 2018 19:02:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 741B028BB1 for ; Thu, 22 Feb 2018 19:02:44 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id DB4D82677F8; Thu, 22 Feb 2018 20:02:42 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id DF0312677F9; Thu, 22 Feb 2018 20:02:40 +0100 (CET) Received: from mail-qt0-f196.google.com (mail-qt0-f196.google.com [209.85.216.196]) by alsa0.perex.cz (Postfix) with ESMTP id 9D8EF2677F6 for ; Thu, 22 Feb 2018 20:02:37 +0100 (CET) Received: by mail-qt0-f196.google.com with SMTP id d8so7656536qtm.0 for ; Thu, 22 Feb 2018 11:02:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=IlzhSJS96ua7ix2yE+QdZLTBep6ykThtDECMnnAKQ08=; b=cr9Ye6Ub/SL/sB2DqRnZVCa7rAX7577fEVuz/68cKRTuz/V+IGdUJQ2u+gM6JDBhPs 4ymuJNMB72oTBJWvmemsdRsDadJdvf+TTLk/rD5MyU87x+b6PzguzF+xkH0woqmdAKsf LXLvqG2GAnq7cdwiFKxxSwuzLRy/vSq0NJsEEWvRoieNwxZ0GEDL+oADW6x8xMdEHh9s TJIE33GW3qb/iVsIdNqhBRmM00HMakjYQSsDAAF+IuZm6ylpMx1XZyGavBms/yefKvhe NhimxB6GiZL7lwk48H2AZ9Yae3pfL+yV5WT4hmDnYJ5h3V2Zj1t2kJm1g6Q+QFeYwXs6 ubCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=IlzhSJS96ua7ix2yE+QdZLTBep6ykThtDECMnnAKQ08=; b=UF7CFeBAog1HLsAfS5OJiLcM/19z66LgsJt0hVa0W9pVBbf9puS71QU69KGjJ87l0e 2ZCABLS0J0caVPmwaEgkCTkBSMI7X1ZoaCWMsonlI2jBEe4Y9s42hl/tDN50y8Hhuw96 C3Lh3wIfgSHXQ1f3ZHdYa0nZPUkC4QYKJzQb+1YfyX1eR0t2Y+meIzG0L+6AQcaaV7ZJ L25sIgcR1bR/zk19CkmhFW9BV6bEP7+3ueguRbswWN4DBoU7UeKvtoNozkU1CV4bhs77 8SgfEpl2t4JLNz3Un2eN75jGnjDB1eD6GMa5zPz7XskJDQIVXGbqZeWEJDqnxCXDuDjj /TLA== X-Gm-Message-State: APf1xPDr7JLynCoNxkM39OAzi3dWs4mYd9A2w6oFZIElzbpxO3Nk2/ge kGocr959R5IRFRHSz4wuzuA= X-Google-Smtp-Source: AH8x226S372SatjJSuZA9/TSmVhxNr56SvlRtw1FGKPCGQE313NBkBWFufRTlBYzCNj41KCCqPlrxQ== X-Received: by 10.200.36.37 with SMTP id c34mr12614143qtc.38.1519326156685; Thu, 22 Feb 2018 11:02:36 -0800 (PST) Received: from localhost.localdomain ([2804:14c:482:a5e:d81f:f7db:5766:3221]) by smtp.gmail.com with ESMTPSA id v1sm542539qtg.43.2018.02.22.11.02.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Feb 2018 11:02:36 -0800 (PST) From: Fabio Estevam To: broonie@kernel.org Date: Thu, 22 Feb 2018 16:02:21 -0300 Message-Id: <1519326142-26421-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 2.7.4 Cc: Fabio Estevam , alsa-devel@alsa-project.org, lars@metafoo.de Subject: [alsa-devel] [PATCH 1/2] ASoC: soc-generic-dmaengine-pcm: Fix error handling X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Fabio Estevam When dmaengine_pcm_request_chan_of() fails it should release the previously acquired resources, which in this case is to call kfree(pcm), so jump to the correct point in the error path. Signed-off-by: Fabio Estevam --- sound/soc/soc-generic-dmaengine-pcm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index 768247f..32ea16d 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@ -450,7 +450,7 @@ int snd_dmaengine_pcm_register(struct device *dev, ret = dmaengine_pcm_request_chan_of(pcm, dev, config); if (ret) - goto err_free_dma; + goto err_free_pcm; ret = snd_soc_add_component(dev, &pcm->component, &dmaengine_pcm_component, NULL, 0); @@ -461,6 +461,7 @@ int snd_dmaengine_pcm_register(struct device *dev, err_free_dma: dmaengine_pcm_release_chan(pcm); +err_free_pcm: kfree(pcm); return ret; }