Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp45007pxb; Mon, 13 Sep 2021 12:29:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+6cFWd+N3OxBolnG7n69PLVyQgTorApbwLComJoJB9ngPklBXwXJquIwCXGqrR31alg3G X-Received: by 2002:a17:906:58c7:: with SMTP id e7mr14194853ejs.197.1631561368859; Mon, 13 Sep 2021 12:29:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631561368; cv=none; d=google.com; s=arc-20160816; b=km7Du1oPk9O5CcDeDUf5p3+2j4Ly5py4iwtpumjsI4c2GRGTd4ZGIDnvbh05ImfgQw LXEpqiXKFjGu63ZsNrmMz7KrbZ/xDWt+BBlKmiBz5ckG4yxOtePIRDupHJKP1g0hI10T M304zbvXKg9wHiurEZAD2X5PG5K9Hh0ePKjf9kt2ijJ5T5eLFccSxqnHGESryWA+RbD5 DgY4CbXdUv3n/2+ZlT78dfbiFyX+FaN2cIU96x7uRfbz7fR2u5bTGpp97tiL7t6KLeS3 APa3yjB1JeuTKIRILg3+b7PnUyAlD8LsIYUngIzWjc+JVEjSyxHHcvCPhPQ8CamJdefW ekuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sT9kDpgz9jNC0aPBsKciqUQIZUTZaJJwfcW0CY/GbnQ=; b=gPZf6czVAaysJQatETPSTP1aexfOHK9ITiNnA/3J+bLzgFZf8s2xDFfxrCIAYoJXaW 43e6ZCP6BiAUCQQlrH7rqBf2OBjirKxWn9OmIP6A0jvv6bw5f99Fd78YvE3ZprU4dZ// sRuJ5NmP8XW052xKd2L5peyDi6/PW+TBTXGoSjn7OBbqsCbjgnIcky8gi6aODcsaoIKg 0slJO73A0HF0lktiCBYUtDYwSIDYjYoCZFc6X3rmAuwvSIPdrPAlMYKX0+vYpnDhdxRW U1OzxzJlmoIuFrtrUO+jNJgwVZ6S4Gn13l/rzWSsqovgQ0wc4IVIHhc7jXjoCgr94Lud wNIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LVDO65Px; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g17si1219136edv.127.2021.09.13.12.29.05; Mon, 13 Sep 2021 12:29:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LVDO65Px; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242047AbhIMNdT (ORCPT + 99 others); Mon, 13 Sep 2021 09:33:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:34836 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241340AbhIMNXy (ORCPT ); Mon, 13 Sep 2021 09:23:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0A193610E6; Mon, 13 Sep 2021 13:21:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539298; bh=eCqa3Xy4ktPc6sqC8YVoXvBmu21imrKosMhLGXgVduE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LVDO65Px7KOiLMmFApk1ILQVMOI/OzJLBZiULMZkpfi4iHgVDcqINxu/oNpP42Ntt 1Zs6knJlvOUlTVLxGnbxh7SKf2EvS2wL0EgED0H83vqpCNOd9Bk0W+0H9yvQaSlkB9 noRvrAN9Txs1uWaFa4t+URMBILglwxOYwJOw20T0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Mark Brown , Sasha Levin Subject: [PATCH 5.4 116/144] ASoC: wcd9335: Fix a memory leak in the error handling path of the probe function Date: Mon, 13 Sep 2021 15:14:57 +0200 Message-Id: <20210913131051.811849464@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131047.974309396@linuxfoundation.org> References: <20210913131047.974309396@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe JAILLET [ Upstream commit fc6fc81caa63900cef9ebb8b2e365c3ed5a9effb ] If 'wcd9335_setup_irqs()' fails, me must release the memory allocated in 'wcd_clsh_ctrl_alloc()', as already done in the remove function. Add an error handling path and the missing 'wcd_clsh_ctrl_free()' call. Fixes: 20aedafdf492 ("ASoC: wcd9335: add support to wcd9335 codec") Signed-off-by: Christophe JAILLET Message-Id: <6dc12372f09fabb70bf05941dbe6a1382dc93e43.1629091028.git.christophe.jaillet@wanadoo.fr> Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/wcd9335.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c index a31a20dcd6b5..5ec63217ad02 100644 --- a/sound/soc/codecs/wcd9335.c +++ b/sound/soc/codecs/wcd9335.c @@ -4844,6 +4844,7 @@ static void wcd9335_codec_init(struct snd_soc_component *component) static int wcd9335_codec_probe(struct snd_soc_component *component) { struct wcd9335_codec *wcd = dev_get_drvdata(component->dev); + int ret; int i; snd_soc_component_init_regmap(component, wcd->regmap); @@ -4861,7 +4862,15 @@ static int wcd9335_codec_probe(struct snd_soc_component *component) for (i = 0; i < NUM_CODEC_DAIS; i++) INIT_LIST_HEAD(&wcd->dai[i].slim_ch_list); - return wcd9335_setup_irqs(wcd); + ret = wcd9335_setup_irqs(wcd); + if (ret) + goto free_clsh_ctrl; + + return 0; + +free_clsh_ctrl: + wcd_clsh_ctrl_free(wcd->clsh_ctrl); + return ret; } static void wcd9335_codec_remove(struct snd_soc_component *comp) -- 2.30.2