Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3020919rwb; Mon, 15 Aug 2022 16:18:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR7QUDDlu8QP7yiwF3Rp3/JED4oBSbeVtfR3Xgtgcc7opz8iXVs5R1UgcMk/g4+H8ShKyO72 X-Received: by 2002:a63:5201:0:b0:41e:2089:7174 with SMTP id g1-20020a635201000000b0041e20897174mr15559614pgb.519.1660605483921; Mon, 15 Aug 2022 16:18:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605483; cv=none; d=google.com; s=arc-20160816; b=ohYoXdoeElTm/NpfWycmFgsD20UAyHzdd6a5e1B69I7v/wz3HJ0ovn9ElfIB8Q5RWs CQvbX87K8Bh/4WV8BQRY/gF8Y/4sTzEOPE2C85RAIKfqJIt5QOy3ks4Ydxfsd3v8Q0Te GoJ6V0eZLDwGwZJ4KAgk3P0x8ZvJ7Ou4MBJU3VAqJKxXX1FVti+3ukPAERn0jleKKWkz tA0obnSOTpwRBeLsodIllkzvToZo+ShVghCJ7Dq180sKZGcnH7nmeDlglFB04qlKdwBp X57sRbZ8nrgNRPtBcZtt/kSLX2eCx75pdL7sjhGC87xHwmIob5GXe6XBgVVFlraTX4W+ 5vJA== 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=10a8iWEbxmDdFfPDQ8mHX9LOwGCQoGnteLP0lTvk6eQ=; b=da9B/Jz7AGrxhqczNJ0L+IwfLiTeOy1kg93zoZsCxhlH5A+G67Q19Xd9s+OdhIW2s0 mOtji4XQSJUjbtAsXJvVYXiyLEv+cs4CrGGp8LWYwn0K3oJaIFNi5aS1ofkRbhE2bK7C KBKu26LesKOC+jWZS5Qy4LH52fQEYLeYgtgw4u05QK1hxhXsNNZ3+d1hSlLs9skKuuZ5 Nqr5MGBYOumXEJfgxSgp7CYVVjh6mEzRlSPEf5KlQkCzN49xORV4nxCoR+nwXd52/wI7 oHE2kDKnfOlVryeUtXesVANPVmtJebJSCiw4kbhDEKhbMC96H9Vh5pG/U3kn4mHU4YZV UwYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="hFhvVUS/"; 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 w12-20020a170902e88c00b0016ed8e1897bsi12716932plg.554.2022.08.15.16.17.52; Mon, 15 Aug 2022 16:18:03 -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="hFhvVUS/"; 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 S1350331AbiHOWbi (ORCPT + 99 others); Mon, 15 Aug 2022 18:31:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350191AbiHOW00 (ORCPT ); Mon, 15 Aug 2022 18:26:26 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84214128463; Mon, 15 Aug 2022 12:45:08 -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 sin.source.kernel.org (Postfix) with ESMTPS id 7E6ACCE12E4; Mon, 15 Aug 2022 19:45:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63A17C433D6; Mon, 15 Aug 2022 19:45:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592704; bh=zfl6Pl3K4qT0tKLKmfKOMaYKm1X2H/9fLtFsWsnGeQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hFhvVUS/pS1HoM9I2K1rsDH1Mk90rydGkCgyRMNIgir9HEvN9BvnDnWzNM+CZENvT dP+kzTKhSisSwVEEYXqs90ZMeQNh81KsvH3vXInN/8th2Wi9yRikjq8EsDQpX1XdRb pnZ5YnKE69JhXhuliUecGCFAHIOJ2WzhiON8zcEg= 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 0833/1095] ASoC: mediatek: mt8173-rt5650: Fix refcount leak in mt8173_rt5650_dev_probe Date: Mon, 15 Aug 2022 20:03:52 +0200 Message-Id: <20220815180503.780351868@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 efe2178d1a32492f99e7f1f2568eea5c88a85729 ] of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Fix refcount leak in some error paths. Fixes: 0f83f9296d5c ("ASoC: mediatek: Add machine driver for ALC5650 codec") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220603124243.31358-1-linmq006@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/mediatek/mt8173/mt8173-rt5650.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650.c b/sound/soc/mediatek/mt8173/mt8173-rt5650.c index fc164f4f95f8..487807ee7019 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650.c @@ -280,7 +280,8 @@ static int mt8173_rt5650_dev_probe(struct platform_device *pdev) if (!mt8173_rt5650_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_platform_node; } mt8173_rt5650_dais[DAI_LINK_CODEC_I2S].codecs[1].of_node = mt8173_rt5650_dais[DAI_LINK_CODEC_I2S].codecs[0].of_node; @@ -293,7 +294,7 @@ static int mt8173_rt5650_dev_probe(struct platform_device *pdev) dev_err(&pdev->dev, "%s codec_capture_dai name fail %d\n", __func__, ret); - return ret; + goto put_platform_node; } mt8173_rt5650_dais[DAI_LINK_CODEC_I2S].codecs[1].dai_name = codec_capture_dai; @@ -315,12 +316,14 @@ static int mt8173_rt5650_dev_probe(struct platform_device *pdev) if (!mt8173_rt5650_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_platform_node; } card->dev = &pdev->dev; ret = devm_snd_soc_register_card(&pdev->dev, card); +put_platform_node: of_node_put(platform_node); return ret; } -- 2.35.1