Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3413241rwa; Tue, 23 Aug 2022 04:29:28 -0700 (PDT) X-Google-Smtp-Source: AA6agR46rItR5CyAi73DCRY2fWLYXomfRlQ0hCo1z3PmsX6qI/dQ4/+IL9S7OAfaqk3UnaCODOuj X-Received: by 2002:a17:902:d2d1:b0:172:e5f6:24b with SMTP id n17-20020a170902d2d100b00172e5f6024bmr10211878plc.45.1661254167958; Tue, 23 Aug 2022 04:29:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661254167; cv=none; d=google.com; s=arc-20160816; b=NVf0Tq02NFN0+tCnoyOcM5Q03KR+HGpnIyQxXkKbqE4LICjgea28Phq10aTDzglAvh eDoScqdXmjOcITCyvglnyKGhQ5CFy9AWouwrbqhEi2nYDFJO9RybX70Rw+eAQAcJ7dmu l1UBuLMQ3ZorrldtkoaY4xrY8YXp36iy+FhWiA9NKbYFqfaM0zb91bEuzXyGLKPk0P9c H7d/EeziT+zdeMWT744kldgOrkjyfpvILK+Cl41c4Ny1zuMR062Xo231ZE0ITc4W6PkN cnuPvCY4s6OuBaPheBXRVTUBwqSqdrJVbT1M0RKMBcAJyfku5zOzThrlhkuCR8Uh0xk3 KwPQ== 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=z2z0TnGiV7swNiyXq8xjUHMZ5smfcIBPcwBAEwFwviU=; b=HKIrL9Cv9nt7XBnbu4hdcCFUJLFTMG8tB4wVDpB1B1Byf6+mKFVs7DwGqdqKMoO2Au WYfn8ure8xsu6NsaKT11XdIubIGzAiopY6/+3Z/88B59HO1mpPDchbQEzNcGwFPmFEdJ fiO3utNldi36czQyMilw4UdK8czgAMhhXJCptV3+QLOvph/MPqJauLJ9XeoLQDxtKGTI 625ZyfeuoU13rB10NnohH9ykRG2Q2s0OFr/W2XCVDWlWrqU0HdxK1ojCaB+4D6MN/FzV 4+wh4mhOjde3Fwe5LQeZ/2nGnQuJQkHRaQeJPguMoBtDe52tkbiFewsI52DaOwl7VT1v sjBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mtK2VeYk; 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 b9-20020a631b49000000b00415e130eb76si15014427pgm.685.2022.08.23.04.29.16; Tue, 23 Aug 2022 04:29:27 -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=mtK2VeYk; 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 S242759AbiHWJ5q (ORCPT + 99 others); Tue, 23 Aug 2022 05:57:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243219AbiHWJwj (ORCPT ); Tue, 23 Aug 2022 05:52:39 -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 F04C37B78A; Tue, 23 Aug 2022 01:46:19 -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 8282CB81C53; Tue, 23 Aug 2022 08:45:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E690AC433C1; Tue, 23 Aug 2022 08:45:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661244314; bh=OIFz9Puy2x0e9AK+d1L7NJn2m8YPZnlzGVGHvm1SSgI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mtK2VeYkMUPGo7bihZHvYN48T03TepmRCSYPYZRsDiKKpypI1P/dEKVAsUV/1rWN+ TOviHoiExTcQv7OUe6crxPABS9510xdvw6EkrmJz0oUWiddmIHcAsxqPajj5ABAE0j /Eo4a09bV1uF+QFr/8Vfi5BVRcP3DXyUSD1qksLE= 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 4.14 118/229] ASoC: mediatek: mt8173: Fix refcount leak in mt8173_rt5650_rt5676_dev_probe Date: Tue, 23 Aug 2022 10:24:39 +0200 Message-Id: <20220823080057.908983731@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080053.202747790@linuxfoundation.org> References: <20220823080053.202747790@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 61b0d8f8678e..90606b177eaf 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c @@ -255,14 +255,16 @@ static int mt8173_rt5650_rt5676_dev_probe(struct platform_device *pdev) if (!mt8173_rt5650_rt5676_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_codecs[1].of_node = of_parse_phandle(pdev->dev.of_node, "mediatek,audio-codec", 1); if (!mt8173_rt5650_rt5676_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].of_node = mt8173_rt5650_rt5676_codecs[1].of_node; @@ -275,7 +277,8 @@ static int mt8173_rt5650_rt5676_dev_probe(struct platform_device *pdev) if (!mt8173_rt5650_rt5676_dais[DAI_LINK_HDMI_I2S].codec_of_node) { dev_err(&pdev->dev, "Property 'audio-codec' missing or invalid\n"); - return -EINVAL; + ret = -EINVAL; + goto put_node; } card->dev = &pdev->dev; @@ -285,6 +288,7 @@ static int mt8173_rt5650_rt5676_dev_probe(struct platform_device *pdev) dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", __func__, ret); +put_node: of_node_put(platform_node); return ret; } -- 2.35.1