From patchwork Mon Oct 24 11:30:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8600 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419476wru; Mon, 24 Oct 2022 05:16:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76QUx8nA4b9PoXHEbWjuLpICsAX8tPVZcWhlDjCbVj4QWRQ3KSbqxZ30FJ0DMln5XOUTKa X-Received: by 2002:a17:907:7f05:b0:78d:e869:f2fe with SMTP id qf5-20020a1709077f0500b0078de869f2femr25900209ejc.684.1666613781954; Mon, 24 Oct 2022 05:16:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613781; cv=none; d=google.com; s=arc-20160816; b=pc1yPs1y02J47XMPnBRVpi4uYzhkABI3E3DCIxcvBDhlo7iAiKHBy9ikPWsoLZz1D7 2gQpXiNdkUolZWY3Npg7+9fp8P+OQbwXd40QpyJI2XEO2l3vmGb291HxMv/ivAq3RcYZ OPmJGO94uUaonyim+JWaQCLQH04D/ef+dz0EXLtRh0yM7NnDiaOJBVewKwNwN1y6Y9YF 6TOcNnIsBqdAQmVup9RW0zXAOFUuP95J7wAqrhU0VLRlAw11KdnvHph8ToAPG7W5Lr3M JR4YFXH4/1leyvAHS15/ZscxgFb/i7SDdNYDax5HILd+ZFQ1fNyVPXYl/s9YHvNpTu8D F4Pw== 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=XyuslodraOlWLSKMKKFwSYlnI+b/jhPHllu1tFE+hNo=; b=js3onl5GzSPriu2JlCTuWQ543qRkT44Be+JLLOJzS8DifNdYqCdehVeQxMH4RxEAz1 pJZ3lgaeIrJDHMG0D2AKGxYJpujAQF1MmxiFOBe6P6cM0r5m8hM8ZdWsjieoiWQmG/eB iz4E3uPSEnRIuUtaoqSSwOy7V6SN+7990OFBrtsksuX5AhPw5/6BhQ8pLSYKeyAE7hHY jeTdIDsNBjkhalLS00MPGvOVhgcWA6FVKQtQ4NGN7OrJgwK5JpCeKrGweIemLZ1ZbZEB DZaBeq5CdBclTl3ASrALBQrovHRgVdARhB70ARTWsTPi0T3Ho70OVeHWIdrW8qImO6yZ wI7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Eh+3wf2y; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s3-20020a17090699c300b0078e254ae43fsi30611321ejn.787.2022.10.24.05.15.57; Mon, 24 Oct 2022 05:16:21 -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=Eh+3wf2y; 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 S232768AbiJXMH5 (ORCPT + 99 others); Mon, 24 Oct 2022 08:07:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233108AbiJXMFI (ORCPT ); Mon, 24 Oct 2022 08:05:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EFF37D7AF; Mon, 24 Oct 2022 04:51:16 -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 dfw.source.kernel.org (Postfix) with ESMTPS id C8611612CE; Mon, 24 Oct 2022 11:51:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCD2AC433D6; Mon, 24 Oct 2022 11:51:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612271; bh=a8l/I2TuFnDZ2LIT3P89OUO8cHanDUNMh7fG1SpkHa8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Eh+3wf2yBzhC1Tn7nq2JcTWgZ6y6XJqqqDjK2Pt4YDq3xmeBSATSf+/eBbeiwKqcH WJRhV9bgsnhWDDd7tD/O24sExFLFAwMP9ECBtk78arVThNK3qTYDTN4XV2pAtaBsWv Cvk4N+aDIuA0EgaqzUAIJ15rqam+gYfTq09P5LHI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Mark Brown , Sasha Levin , Kelin Wang Subject: [PATCH 4.14 103/210] ASoC: eureka-tlv320: Hold reference returned from of_find_xxx API Date: Mon, 24 Oct 2022 13:30:20 +0200 Message-Id: <20221024113000.357615385@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571212778990324?= X-GMAIL-MSGID: =?utf-8?q?1747571212778990324?= From: Liang He [ Upstream commit bfb735a3ceff0bab6473bac275da96f9b2a06dec ] In eukrea_tlv320_probe(), we need to hold the reference returned from of_find_compatible_node() which has increased the refcount and then call of_node_put() with it when done. Fixes: 66f232908de2 ("ASoC: eukrea-tlv320: Add DT support.") Co-authored-by: Kelin Wang Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220914134354.3995587-1-windhl@126.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/fsl/eukrea-tlv320.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sound/soc/fsl/eukrea-tlv320.c b/sound/soc/fsl/eukrea-tlv320.c index 4c6f19ef98b2..04ef886f71b2 100644 --- a/sound/soc/fsl/eukrea-tlv320.c +++ b/sound/soc/fsl/eukrea-tlv320.c @@ -88,7 +88,7 @@ static int eukrea_tlv320_probe(struct platform_device *pdev) int ret; int int_port = 0, ext_port; struct device_node *np = pdev->dev.of_node; - struct device_node *ssi_np = NULL, *codec_np = NULL; + struct device_node *ssi_np = NULL, *codec_np = NULL, *tmp_np = NULL; eukrea_tlv320.dev = &pdev->dev; if (np) { @@ -145,7 +145,7 @@ static int eukrea_tlv320_probe(struct platform_device *pdev) } if (machine_is_eukrea_cpuimx27() || - of_find_compatible_node(NULL, NULL, "fsl,imx21-audmux")) { + (tmp_np = of_find_compatible_node(NULL, NULL, "fsl,imx21-audmux"))) { imx_audmux_v1_configure_port(MX27_AUDMUX_HPCR1_SSI0, IMX_AUDMUX_V1_PCR_SYN | IMX_AUDMUX_V1_PCR_TFSDIR | @@ -160,10 +160,11 @@ static int eukrea_tlv320_probe(struct platform_device *pdev) IMX_AUDMUX_V1_PCR_SYN | IMX_AUDMUX_V1_PCR_RXDSEL(MX27_AUDMUX_HPCR1_SSI0) ); + of_node_put(tmp_np); } else if (machine_is_eukrea_cpuimx25sd() || machine_is_eukrea_cpuimx35sd() || machine_is_eukrea_cpuimx51sd() || - of_find_compatible_node(NULL, NULL, "fsl,imx31-audmux")) { + (tmp_np = of_find_compatible_node(NULL, NULL, "fsl,imx31-audmux"))) { if (!np) ext_port = machine_is_eukrea_cpuimx25sd() ? 4 : 3; @@ -180,6 +181,7 @@ static int eukrea_tlv320_probe(struct platform_device *pdev) IMX_AUDMUX_V2_PTCR_SYN, IMX_AUDMUX_V2_PDCR_RXDSEL(int_port) ); + of_node_put(tmp_np); } else { if (np) { /* The eukrea,asoc-tlv320 driver was explicitly