Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1638172ybh; Thu, 16 Jul 2020 18:49:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8GvyFv2NyYtI90vOf9vS8Dn5eYvLephqGXRJ8lIv7JD+qOkjmuni+rajVO9by1H92f4V8 X-Received: by 2002:a50:b5e3:: with SMTP id a90mr6844739ede.381.1594950596719; Thu, 16 Jul 2020 18:49:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594950596; cv=none; d=google.com; s=arc-20160816; b=IlM09q147eMgALoTHntRrl9aAW5F84jOmA0n3yElDxlf5q3LB1NMmg1sMwEU/TKSIL Gm2ddFPCz4K8KbGNav/LMYXpuIDDXtfOh58etdB9kFxJTziu15rzLfbreeyL2WKthkNl +82zuwS2DyjUhHIPGYMbQQboxRNq2sFusbLcKPxAjlErdArLQKESKSw8EoUxfIPPrQ6q CEV4GmgXqUEPO3/R+ePz1LqnguaUDO3SCRb4aYoWGXnWBiwpwtiDG3Uuot7G4D9iFHbe Bhk9+ZDm2nVRKQkCUlDdRydM+RzpVOtGXnwB9jcykmcD+DYWKk7YyFpF19Gj+oBiZaXc 5j0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=umyeAlr7j44OQKNsYtjYFGL1rSAamF+wBHwuRgvt79c=; b=dxTAbU06XQqCKu7PwVNGIcFeMZXxNixbGiAD2/stYOqnA7iPcPlfcmVEbmw+ID3snE bdxfCIbZfzhMOGiJm9jqfIXfCMvpD9IGAn6wSinJSC4/unijVVXkEb1YwD0sYAFRhRa3 9MHSjMwzXo95GHMkEulxNe+VxobcQSQU8ZF9adtzN+tScLwEXYr1aeoPLe/AkGz5jEHp i/+biz3nDubCB7Beed6jXhJJftdSSFz43OGLRH/a2I6G4d8Ddq0cqKCGgtvYTMLDrhpd xpDCxakQKgSjcVKmVvvhJJ0+aS5TEmaPRcEG5lCWqbt0NY2eEyhAFt5PD9fApyDt4xOp YLcw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i26si4070499ejk.576.2020.07.16.18.49.34; Thu, 16 Jul 2020 18:49:56 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726801AbgGQBtY (ORCPT + 99 others); Thu, 16 Jul 2020 21:49:24 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:36320 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726710AbgGQBtW (ORCPT ); Thu, 16 Jul 2020 21:49:22 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 6E78924D9B1F4BEE533D; Fri, 17 Jul 2020 09:49:20 +0800 (CST) Received: from [10.174.179.105] (10.174.179.105) by smtp.huawei.com (10.3.19.210) with Microsoft SMTP Server (TLS) id 14.3.487.0; Fri, 17 Jul 2020 09:49:15 +0800 Subject: Re: [PATCH] ASoC: meson: add the missed kfree() for axg_card_add_tdm_loopback To: Jerome Brunet , , , , , , References: <20200716132558.33932-1-jingxiangfeng@huawei.com> <1jzh7zegfw.fsf@starbuckisacylon.baylibre.com> CC: , , , From: Jing Xiangfeng Message-ID: <5F11039A.7040308@huawei.com> Date: Fri, 17 Jul 2020 09:49:14 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <1jzh7zegfw.fsf@starbuckisacylon.baylibre.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.105] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/7/16 21:29, Jerome Brunet wrote: > > On Thu 16 Jul 2020 at 15:25, Jing Xiangfeng wrote: > >> axg_card_add_tdm_loopback() misses to call kfree() in an error path. Add >> the missed function call to fix it. >> >> Fixes: c84836d7f650 ("ASoC: meson: axg-card: use modern dai_link style") >> Signed-off-by: Jing Xiangfeng > > Thanks for fixing this. > Maybe it would be better to use the devm_ variant for the name instead ? Ok, I'll send a v2 with this change. Thanks for your review. > >> --- >> sound/soc/meson/axg-card.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/sound/soc/meson/axg-card.c b/sound/soc/meson/axg-card.c >> index 89f7f64747cd..6eac22ba8b99 100644 >> --- a/sound/soc/meson/axg-card.c >> +++ b/sound/soc/meson/axg-card.c >> @@ -121,8 +121,10 @@ static int axg_card_add_tdm_loopback(struct snd_soc_card *card, >> return -ENOMEM; >> >> dlc = devm_kzalloc(card->dev, 2 * sizeof(*dlc), GFP_KERNEL); >> - if (!dlc) >> + if (!dlc) { >> + kfree(lb->name); >> return -ENOMEM; >> + } >> >> lb->cpus = &dlc[0]; >> lb->codecs = &dlc[1]; > > . >