From nobody Fri Sep 5 20:19:51 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32C9FC32772 for ; Tue, 23 Aug 2022 11:34:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349736AbiHWLeS (ORCPT ); Tue, 23 Aug 2022 07:34:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232577AbiHWL3r (ORCPT ); Tue, 23 Aug 2022 07:29:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DD2BC6514; Tue, 23 Aug 2022 02:25:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ECD26B81C88; Tue, 23 Aug 2022 09:25:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45F32C433C1; Tue, 23 Aug 2022 09:25:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661246737; bh=DF7PTMewUFfS/ZB+3tf2747d7ms+FLwktLmvT2BQnNg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pMliU7eayKxSFcCsnrd1r8YMbXtlGLHKj/LJAjUEXwU17C5fdpBSlpXUsc8lZ5ah2 BepXTRMLi6Iz0jiHngWCJBjA7oHBegz4xvbLv5slqh4TQhSVnoobY1S2kfsbNVflS7 Fqr954FwuuAmniPe97FInBpoQTHSABTj4ncCHFtQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Mark Brown , Sasha Levin Subject: [PATCH 5.4 204/389] ASoC: mt6797-mt6351: Fix refcount leak in mt6797_mt6351_dev_probe Date: Tue, 23 Aug 2022 10:24:42 +0200 Message-Id: <20220823080124.170980714@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080115.331990024@linuxfoundation.org> References: <20220823080115.331990024@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 7472eb8d7dd12b6b9b1a4f4527719cc9c7f5965f ] of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: f0ab0bf250da ("ASoC: add mt6797-mt6351 driver and config option") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220603083417.9011-1-linmq006@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/mediatek/mt6797/mt6797-mt6351.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sound/soc/mediatek/mt6797/mt6797-mt6351.c b/sound/soc/mediatek= /mt6797/mt6797-mt6351.c index 496f32bcfb5e..d2f6213a6bfc 100644 --- a/sound/soc/mediatek/mt6797/mt6797-mt6351.c +++ b/sound/soc/mediatek/mt6797/mt6797-mt6351.c @@ -217,7 +217,8 @@ static int mt6797_mt6351_dev_probe(struct platform_devi= ce *pdev) if (!codec_node) { dev_err(&pdev->dev, "Property 'audio-codec' missing or invalid\n"); - return -EINVAL; + ret =3D -EINVAL; + goto put_platform_node; } for_each_card_prelinks(card, i, dai_link) { if (dai_link->codecs->name) @@ -230,6 +231,9 @@ static int mt6797_mt6351_dev_probe(struct platform_devi= ce *pdev) dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", __func__, ret); =20 + of_node_put(codec_node); +put_platform_node: + of_node_put(platform_node); return ret; } =20 --=20 2.35.1