From patchwork Mon Apr 3 15:26:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liliang Ye X-Patchwork-Id: 13198333 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 81710C76188 for ; Mon, 3 Apr 2023 15:39:23 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1E6241FE; Mon, 3 Apr 2023 17:38:31 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1E6241FE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1680536361; bh=cB27IzkAafy+IWw9S5kJqvtMcIEUaK/BrwzsF3n4r1A=; h=From:To:Subject:Date:CC:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=B/jbyC0X6CMSdxLsJgePMo8BvuOQc7yqn1M3lgwB34eyH+OB5tzKbrFLSYAceJC4K z9y70JMWUA2JwPlC2sHR+ppNc5/nUBgMRNHqlW35mc2zMBmk12QwJOm56LchARby+8 qqI3qdEZSCOk8bjwd9V3SkaoGr9RTrNfGjf/Vz7s= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id B5F4CF8057B; Mon, 3 Apr 2023 17:36:59 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 23193F8024C; Mon, 3 Apr 2023 17:27:38 +0200 (CEST) Received: from hust.edu.cn (unknown [202.114.0.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 713CAF80171 for ; Mon, 3 Apr 2023 17:27:30 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 713CAF80171 Received: from LAPTOP-6NFQSDTK.localdomain ([10.12.182.145]) (user=yll@hust.edu.cn mech=LOGIN bits=0) by mx1.hust.edu.cn with ESMTP id 333FRJ5h024979-333FRJ5i024979 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 3 Apr 2023 23:27:24 +0800 From: Liliang Ye To: Shengjiu Wang , Xiubo Li , Fabio Estevam , Nicolin Chen , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Dan Carpenter Subject: [PATCH 1/2] ASoC: fsl_mqs: move of_node_put() to the correct location Date: Mon, 3 Apr 2023 23:26:47 +0800 Message-Id: <20230403152647.17638-1-yll@hust.edu.cn> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-FEAS-AUTH-USER: yll@hust.edu.cn X-MailFrom: yll@hust.edu.cn X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: RDPLHPWY4JEHD7JI7DUF7DWSNY4ZBZPS X-Message-ID-Hash: RDPLHPWY4JEHD7JI7DUF7DWSNY4ZBZPS X-Mailman-Approved-At: Mon, 03 Apr 2023 15:36:51 +0000 CC: hust-os-kernel-patches@googlegroups.com, Liliang Ye , alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: of_node_put() should have been done directly after mqs_priv->regmap = syscon_node_to_regmap(gpr_np); otherwise it creates a reference leak on the success path. To fix this, of_node_put() is moved to the correct location, and change all the gotos to direct returns. Fixes: a9d273671440 ("ASoC: fsl_mqs: Fix error handling in probe") Signed-off-by: Liliang Ye Reviewed-by: Dan Carpenter --- sound/soc/fsl/fsl_mqs.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/sound/soc/fsl/fsl_mqs.c b/sound/soc/fsl/fsl_mqs.c index 4922e6795b73..32d20d351bbf 100644 --- a/sound/soc/fsl/fsl_mqs.c +++ b/sound/soc/fsl/fsl_mqs.c @@ -210,10 +210,10 @@ static int fsl_mqs_probe(struct platform_device *pdev) } mqs_priv->regmap = syscon_node_to_regmap(gpr_np); + of_node_put(gpr_np); if (IS_ERR(mqs_priv->regmap)) { dev_err(&pdev->dev, "failed to get gpr regmap\n"); - ret = PTR_ERR(mqs_priv->regmap); - goto err_free_gpr_np; + return PTR_ERR(mqs_priv->regmap); } } else { regs = devm_platform_ioremap_resource(pdev, 0); @@ -242,8 +242,7 @@ static int fsl_mqs_probe(struct platform_device *pdev) if (IS_ERR(mqs_priv->mclk)) { dev_err(&pdev->dev, "failed to get the clock: %ld\n", PTR_ERR(mqs_priv->mclk)); - ret = PTR_ERR(mqs_priv->mclk); - goto err_free_gpr_np; + return PTR_ERR(mqs_priv->mclk); } dev_set_drvdata(&pdev->dev, mqs_priv); @@ -252,13 +251,9 @@ static int fsl_mqs_probe(struct platform_device *pdev) ret = devm_snd_soc_register_component(&pdev->dev, &soc_codec_fsl_mqs, &fsl_mqs_dai, 1); if (ret) - goto err_free_gpr_np; - return 0; - -err_free_gpr_np: - of_node_put(gpr_np); + return ret; - return ret; + return 0; } static int fsl_mqs_remove(struct platform_device *pdev) From patchwork Mon Apr 3 15:27:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liliang Ye X-Patchwork-Id: 13198334 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AC4C2C761A6 for ; Mon, 3 Apr 2023 15:39:41 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 762D5209; Mon, 3 Apr 2023 17:38:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 762D5209 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1680536379; bh=EgJ0lJLYYg38rEZlojze62aOyU1WkYNhgyR7p/kPTfs=; h=From:To:Subject:Date:CC:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=RyEoV8etkACpra5r/pTD/IaIA11m/6wWZlUIqBiiP8k+LeCnmYIGr0iTQPFS5J/LT Ij3M54Bv3Qu+L+rFqsCtVH7tA4XzKPc6tio2hny3u0soBId1np7DrI4it+HN6btY4J DVOA/XnVVtJr1I7GIG7IOJwjFR6X2I2TB4UUqXSY= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 39B49F80579; Mon, 3 Apr 2023 17:37:02 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6251FF8024C; Mon, 3 Apr 2023 17:28:18 +0200 (CEST) Received: from hust.edu.cn (unknown [202.114.0.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 5CC77F8015B for ; Mon, 3 Apr 2023 17:28:14 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5CC77F8015B Received: from LAPTOP-6NFQSDTK.localdomain ([10.12.182.145]) (user=yll@hust.edu.cn mech=LOGIN bits=0) by mx1.hust.edu.cn with ESMTP id 333FS2bR027146-333FS2bS027146 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 3 Apr 2023 23:28:08 +0800 From: Liliang Ye To: Shengjiu Wang , Xiubo Li , Fabio Estevam , Nicolin Chen , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Subject: [PATCH 2/2] ASoC: fsl_mqs: call pm_runtime_disable() on error path Date: Mon, 3 Apr 2023 23:27:37 +0800 Message-Id: <20230403152737.17671-1-yll@hust.edu.cn> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-FEAS-AUTH-USER: yll@hust.edu.cn X-MailFrom: yll@hust.edu.cn X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: T4P4PUWLDPNLXOLW6BVEOPROWQNTHMQ2 X-Message-ID-Hash: T4P4PUWLDPNLXOLW6BVEOPROWQNTHMQ2 X-Mailman-Approved-At: Mon, 03 Apr 2023 15:36:51 +0000 CC: hust-os-kernel-patches@googlegroups.com, Liliang Ye , Dan Carpenter , Shengjiu Wang , alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: pm_runtime_disable was missed in cleanup operation, which corresponds to the earlier call to pm_runtime_enable. To fix this, add pm_runtime_disable() on error path. Fixes: 9e28f6532c61 ("ASoC: fsl_mqs: Add MQS component driver") Signed-off-by: Liliang Ye Reviewed-by: Dan Carpenter --- sound/soc/fsl/fsl_mqs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sound/soc/fsl/fsl_mqs.c b/sound/soc/fsl/fsl_mqs.c index 32d20d351bbf..129d426c60c4 100644 --- a/sound/soc/fsl/fsl_mqs.c +++ b/sound/soc/fsl/fsl_mqs.c @@ -251,9 +251,13 @@ static int fsl_mqs_probe(struct platform_device *pdev) ret = devm_snd_soc_register_component(&pdev->dev, &soc_codec_fsl_mqs, &fsl_mqs_dai, 1); if (ret) - return ret; + goto err_pm_disable; return 0; + +err_pm_disable: + pm_runtime_disable(&pdev->dev); + return ret; } static int fsl_mqs_remove(struct platform_device *pdev)