Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2906343pxa; Tue, 25 Aug 2020 06:39:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYyXxzCPLgzc4QiSAwBCURy5nWtEVOHvWcooGeco099iVSZQb85Keqnn61k5oCw8FvumKG X-Received: by 2002:a17:906:7d16:: with SMTP id u22mr10398355ejo.176.1598362777354; Tue, 25 Aug 2020 06:39:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598362777; cv=none; d=google.com; s=arc-20160816; b=kcQ38afWv15hMcznMw35dKJEl4ooBOOcE9VyTJZ+nQJRuZQxaCqk3Y5nFclCNxIRvv N8zUK9aeFGpr3tfvA3sn5AmbLEjTm0rIiF0oWuqOQGVStbTvahHD56Ue4zyumit6ehjP X/TRkhmbYUJDWgtFNSrsarkPdGtmzK2uPjoLaR2tXSea5tn+LxuOfHTzYMHEgG9BQHJ0 J6nq1EdtGhQ/UCqwpQL8sgUzr1mEUle2Ty2MXvFs2BzF/ZB8LuXqiCc3xaR74QqcTw68 d1fvzjUtPTs9skGZ+WuUw7odAYNfNJkXytPX7yCYRv2pafWuJxC2FyS2Ya78LkZYAhd4 wUWQ== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=McoR9Kb/rT7evPugEaBCHElOy6AKKz0+Fmp+txm2o/o=; b=u5HAXvGesPPjAQun01ZZOaCURl+0Nr3jsLCgwtLGenWS3sTlbMFo3AN/9BCCEOIB43 RVkCUeel7/HlxfpeKg1vCRIP2w1R5uJCBw/5Yii5DST0VkJEInO8tjoW2V+rjP7JL4zh kmKie9xGqvSEd5Ty/W0AOcU7Z7Y+oCJPOv1r7EweWZXDhtMjfohIeQYOrcMoNxUrxDp9 7vE4wEqM37r/ni5zErsbiZFv2gXD2Y4LxPLcVfjtzZYvpv7OlYpaAJZMBiJf+8AB4nUJ Y5Hl1pP8Ih4/LHBWaVLfJe+ePxZIgyEcvnv2HFK6jciIGRM7KXFm/bl08DDTqEqlsVoK 23Dg== 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 z13si8625682edp.430.2020.08.25.06.39.14; Tue, 25 Aug 2020 06:39:37 -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 S1728892AbgHYMGD (ORCPT + 99 others); Tue, 25 Aug 2020 08:06:03 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:52704 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726351AbgHYMGB (ORCPT ); Tue, 25 Aug 2020 08:06:01 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 45575E51671AF449BBA3; Tue, 25 Aug 2020 20:06:00 +0800 (CST) Received: from huawei.com (10.175.127.227) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.487.0; Tue, 25 Aug 2020 20:05:52 +0800 From: Yu Kuai To: , , , , , , , , , , , , , CC: , , , , , Subject: [PATCH 1/2] ASoC: fsl: imx-es8328: add missing kfree() call in imx_es8328_probe() Date: Tue, 25 Aug 2020 20:05:30 +0800 Message-ID: <20200825120531.1479304-2-yukuai3@huawei.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200825120531.1479304-1-yukuai3@huawei.com> References: <20200825120531.1479304-1-yukuai3@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If memory allocation for 'data' or 'comp' succeed, imx_es8328_probe() doesn't have corresponding kfree() in exception handling. Thus add kfree() for this function implementation. Fixes: 7e7292dba215 ("ASoC: fsl: add imx-es8328 machine driver") Signed-off-by: Yu Kuai --- sound/soc/fsl/imx-es8328.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sound/soc/fsl/imx-es8328.c b/sound/soc/fsl/imx-es8328.c index 15a27a2cd0ca..8f71ed3a6f75 100644 --- a/sound/soc/fsl/imx-es8328.c +++ b/sound/soc/fsl/imx-es8328.c @@ -151,7 +151,7 @@ static int imx_es8328_probe(struct platform_device *pdev) comp = devm_kzalloc(dev, 3 * sizeof(*comp), GFP_KERNEL); if (!comp) { ret = -ENOMEM; - goto fail; + goto free_data; } data->dev = dev; @@ -182,12 +182,12 @@ static int imx_es8328_probe(struct platform_device *pdev) ret = snd_soc_of_parse_card_name(&data->card, "model"); if (ret) { dev_err(dev, "Unable to parse card name\n"); - goto fail; + goto free_comp; } ret = snd_soc_of_parse_audio_routing(&data->card, "audio-routing"); if (ret) { dev_err(dev, "Unable to parse routing: %d\n", ret); - goto fail; + goto free_comp; } data->card.num_links = 1; data->card.owner = THIS_MODULE; @@ -196,10 +196,14 @@ static int imx_es8328_probe(struct platform_device *pdev) ret = snd_soc_register_card(&data->card); if (ret) { dev_err(dev, "Unable to register: %d\n", ret); - goto fail; + goto free_comp; } platform_set_drvdata(pdev, data); +free_comp: + kfree(comp); +free_data: + kfree(data); fail: of_node_put(ssi_np); of_node_put(codec_np); -- 2.25.4