Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3085147rwb; Mon, 15 Aug 2022 17:45:55 -0700 (PDT) X-Google-Smtp-Source: AA6agR5edi5Up5AID+//PB0nnfLuGi2K5mHC1XWXjTP6Dz1wddlSuH8Sk6T3YFLZp2AmBhZaaS1j X-Received: by 2002:a05:6402:1e8f:b0:440:eb20:7a05 with SMTP id f15-20020a0564021e8f00b00440eb207a05mr16334771edf.169.1660610755076; Mon, 15 Aug 2022 17:45:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610755; cv=none; d=google.com; s=arc-20160816; b=bv/DpIITViHG3U0CXfoCW8N6kpcmdEQuQ6xAJu9bludHY66ur4Nvb6cV7hn1r6PjyF In1JvF9loxvxaS9wWIxVXsqfVzGCBw4b20SL/Wa5Ytxouyqygpz/+RbxHK8Z5kNszUYR C00Xxwyqoy1mkZeoz9RFwg2+RiIk34pcQcNF5PwI2Bi1dI2cAdtXUL8fAr1hzxPOx3Y2 sy76DWpKaa5jF0cHRND2DXTUqzKzaMNmqbFjcnEbCBY8KQphSN/B7W0PgheSbtPT6sSO HoYEc6W7pGVyx90pBktLF6EU+cEMjta4Gi7RzGegLaiBRDyeSClEy4R+CLeAnf5wc86W qVhg== 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=eTxLVxAVcLkSDSfPmlJKKkzlzEyXE0W2NGcHZZz0geM=; b=kMQP+tWxpyB7v6TNzsjeeed+U0mq8W0TpOUXI3l4JZqcVVN4q12GUbzLdTSm4zhwrQ 5ozADcSPWxYdvWnjnCOrH1EuhxWn2gQQKHtQOy2zor0+pRHrKmGSHrorn7ERCoK0kdEW MHRMY4L/fmsMzcsRn+oQ+VDScfj5/pwXN9KQEpjJEdiM0+A/le5INZgpmCXAohDU14FK Jjz11zNrEw7/edhHcwgcYEtrcsKnipc+DEUGtPSMZ7poyiOEGBA9bfYT4fIARWgwS1f9 dQi30XiJ+4xWvj36uHX7ceRMROloIAqLkvprIymzDWd0AKvr6STX3heVJpbZowmLDi4C ceMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="WCB0r2T/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m6-20020aa7d346000000b0043d14d03dd9si7721064edr.496.2022.08.15.17.45.29; Mon, 15 Aug 2022 17:45:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="WCB0r2T/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1350923AbiHOWhU (ORCPT + 99 others); Mon, 15 Aug 2022 18:37:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348022AbiHOW3q (ORCPT ); Mon, 15 Aug 2022 18:29:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50E4AD742C; Mon, 15 Aug 2022 12:48:09 -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 64376B80EAB; Mon, 15 Aug 2022 19:48:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A542DC433D7; Mon, 15 Aug 2022 19:48:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592886; bh=JJDjh3JMS1RvAWBuSHwFADZIku6Wki4QrQ2EVkZcrlg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WCB0r2T/19zAZwY2+N/0xnwfgk6qaeeVyOGhwiWtPzR9iXmoa6Iy1HWA+G35lXY2S k5OxaZLEEaVx3+XVOTtYm822UnXiy+YLuV2typGV6P/foMNPDbXxHDRYG6FXFlpuJa CnKULKOw3HYEFJ6rZfm57prjV+2/tdsd0kxSFCiM= 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.18 0830/1095] ASoC: mediatek: mt8173: Fix refcount leak in mt8173_rt5650_rt5676_dev_probe Date: Mon, 15 Aug 2022 20:03:49 +0200 Message-Id: <20220815180503.654840844@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miaoqian Lin [ Upstream commit ae4f11c1ed2d67192fdf3d89db719ee439827c11 ] of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Fix missing of_node_put() in error paths. Fixes: 94319ba10eca ("ASoC: mediatek: Use platform_of_node for machine drivers") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220602034144.60159-1-linmq006@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c index 5716d9299066..c1e8633a74a7 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c @@ -256,14 +256,16 @@ static int mt8173_rt5650_rt5676_dev_probe(struct platform_device *pdev) if (!mt8173_rt5650_rt5676_dais[DAI_LINK_CODEC_I2S].codecs[0].of_node) { dev_err(&pdev->dev, "Property 'audio-codec' missing or invalid\n"); - return -EINVAL; + ret = -EINVAL; + goto put_node; } mt8173_rt5650_rt5676_dais[DAI_LINK_CODEC_I2S].codecs[1].of_node = of_parse_phandle(pdev->dev.of_node, "mediatek,audio-codec", 1); if (!mt8173_rt5650_rt5676_dais[DAI_LINK_CODEC_I2S].codecs[1].of_node) { dev_err(&pdev->dev, "Property 'audio-codec' missing or invalid\n"); - return -EINVAL; + ret = -EINVAL; + goto put_node; } mt8173_rt5650_rt5676_codec_conf[0].dlc.of_node = mt8173_rt5650_rt5676_dais[DAI_LINK_CODEC_I2S].codecs[1].of_node; @@ -276,13 +278,15 @@ static int mt8173_rt5650_rt5676_dev_probe(struct platform_device *pdev) if (!mt8173_rt5650_rt5676_dais[DAI_LINK_HDMI_I2S].codecs->of_node) { dev_err(&pdev->dev, "Property 'audio-codec' missing or invalid\n"); - return -EINVAL; + ret = -EINVAL; + goto put_node; } card->dev = &pdev->dev; ret = devm_snd_soc_register_card(&pdev->dev, card); +put_node: of_node_put(platform_node); return ret; } -- 2.35.1