Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3409466rwa; Tue, 23 Aug 2022 04:25:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR5F2B4OK/kNpYhvEplNqLs3hGG1Ux/sZ8ybWxyY6j9IJbAGZy1Ao8MHjglDKPmN7oALTy6/ X-Received: by 2002:a05:6402:1cc4:b0:440:5af8:41c9 with SMTP id ds4-20020a0564021cc400b004405af841c9mr3267403edb.339.1661253920187; Tue, 23 Aug 2022 04:25:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253920; cv=none; d=google.com; s=arc-20160816; b=DJrdlsoLhZpUEUGQOb6jm65Rt6Z2WxCAgMmlgZrqG3qspkNZfYyWCW0FR5x0LTJag3 XMPHh/Hnt0G+rUM1GpdOI3sQxIHn4T1k5ZO9IqG2OSUDUcpBY4RGd9fHS1VmM/a/7xHN 4v19IkEBt/DJmRV7QckaNY7ojEoHy4I1qfI5URoUEkMQP5PIqJ9Hfwhuw0yj04xEqRhd qOd92hqfnZwNv04B2tgWt/aXEIOcTvtQxaJVt5ktPBjdTME51uF/WngIWCS8CBu5YsTp 19XojTIo5v+x70AjFCAOBsampbpIDR463ufwdKwQLnySr9liuK+4M8kD2EsO3lCLkaQn BQOg== 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=ZYYTQtToxPx7MYYW7qAOBKBbF3AGQ4LsS4V/slzAWN8=; b=WM7aoF2t7iQbpML5ouFJS6VbA4PCJj01OWeinufFjDWYUXjkte15m/4KN1/DCPDKd9 uGFpj4pOJrAdwyfq+k8LwPpaQT8yc+qguqhP8OAFlZHF1VBN5ZTjZ1QGbKBmzWl3NyUz lsHXPFLZqGPMp5dEyasaTUJTElKOu4uEoq6RsEjugP6OhYypp/eFpIK13tiAgj8EU5J1 HJtff94I5KOFykwC1U8gvt7l/G7WTgByNWwqGxEb/FRxu1iHNwuJ885+bQfVRXiTNPVo J824JBRwxx84UwqA0CpBXq22rAMUq97lMgY3DX/33Vkw8vA7A4R0XdP1Ipm6Eq6DA1px tzXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QbNFUHY5; 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 hs7-20020a1709073e8700b0073da49c06a2si972310ejc.948.2022.08.23.04.24.54; Tue, 23 Aug 2022 04:25:20 -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=QbNFUHY5; 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 S1355941AbiHWKp4 (ORCPT + 99 others); Tue, 23 Aug 2022 06:45:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355160AbiHWKiV (ORCPT ); Tue, 23 Aug 2022 06:38:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98C4185FD6; Tue, 23 Aug 2022 02:07:42 -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 4E3DDB81C53; Tue, 23 Aug 2022 09:07:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAE07C433C1; Tue, 23 Aug 2022 09:07:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245660; bh=XCWrOtA6JVIrnzbvAzoqMSzzJ8Y5EaAEADFa+Y7b03g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QbNFUHY5a9o2MGVUTuIxUuTETcqt/Isnn7gTVi/wBISfShr+wbocAu+yUiuOUORBI np742zc9w4I75vefTrc+UwppXABUKN8QjfHovAs4FtzSdyo92Tyx+deiUxlfWQGHWU 9XRNt3gmQSzQgXGHwRLaztuZ9nuCfo0/GL5VXjp0= 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.19 149/287] ASoC: mediatek: mt8173-rt5650: Fix refcount leak in mt8173_rt5650_dev_probe Date: Tue, 23 Aug 2022 10:25:18 +0200 Message-Id: <20220823080105.596353725@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080100.268827165@linuxfoundation.org> References: <20220823080100.268827165@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 14011a70bcc4..8b613f8627fa 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650.c @@ -260,7 +260,8 @@ static int mt8173_rt5650_dev_probe(struct platform_device *pdev) if (!mt8173_rt5650_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_codecs[1].of_node = mt8173_rt5650_codecs[0].of_node; @@ -272,7 +273,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_codecs[1].dai_name = codec_capture_dai; } @@ -293,7 +294,8 @@ static int mt8173_rt5650_dev_probe(struct platform_device *pdev) if (!mt8173_rt5650_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_platform_node; } card->dev = &pdev->dev; @@ -302,6 +304,7 @@ static int mt8173_rt5650_dev_probe(struct platform_device *pdev) dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", __func__, ret); +put_platform_node: of_node_put(platform_node); return ret; } -- 2.35.1