From patchwork Sat Oct 22 07:23:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7548 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105890wrr; Sat, 22 Oct 2022 01:36:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5W3DnENzeh3DECSqphgTkirw92BpC5fgS8s27gJFXTxTf8umYcoZyVY/CvjmIHoyUyhp2S X-Received: by 2002:a05:6a00:1412:b0:557:d887:2025 with SMTP id l18-20020a056a00141200b00557d8872025mr23249559pfu.39.1666427786735; Sat, 22 Oct 2022 01:36:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427786; cv=none; d=google.com; s=arc-20160816; b=rrW8KMtZsab+cwfPjLlTxM/ePDfSiS6x4ivjWc89gZu2TRLNXnosQFnPruE3OL3pMG 4ME9wBHzXDy99m+eGXaw7iAW9+GI1a03ZKSdrETjtj5gcC/A2kzQDWPMF56i85h6a0cn KX5E/S6qSO2cEuBrzIKs/HKYmRc6qN0yDR8i3T9FVg1etN8ZvEGJXzomQaOWxWu2C6RK GIEZFn7z5fCIGdUm1oFLTGsFywP6C7027glFsb/FCCFOLQcAk81B9AUJnoRHz8qibgoE MT7PzJthknjory09Xe837S33S+fRhtXLxKWmOxcN4/jQkJwaAH+/n6tbPtZy1PNBBatU 2Asg== 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=ZeIJKrwyPc0cOIgWlTV2wtQrElNlHhj6dlq4k//Eb3E=; b=UprzPb+hwaaUM45CZ9vPRMN2GatPahhx3EO+7paWVGWzSR6vGCX77oHI0wSQjeDDa7 oKFoznfAW02xCeooZQ7y7No0lvTO8R/VibSldebGGm0kjHo1qZcsjJux+zXCVFp9MJ6T yWbM7SaSLka64QmNimcWPaDeCCyFdoz47nnOl1eORhD1F24eAFYb+N6EcYHcS4WqAL7L 2A7dRVjisP+MRQoJg8g3Hvb4zZh1yS00acKMHBCe2bP1Ik0InkOxCT/yaHn+CrGLjW8B wGg4qLeF8dSTk/u8taeacbSgTjB/jxZubotvcwxHGr1dwaCNTFluSAmHqpecQ5lho0Y1 36Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Wa6Xjzgi; 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 l12-20020a056a0016cc00b005281e5606b2si29283584pfc.32.2022.10.22.01.36.11; Sat, 22 Oct 2022 01:36:26 -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=Wa6Xjzgi; 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 S233453AbiJVIRt (ORCPT + 99 others); Sat, 22 Oct 2022 04:17:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234010AbiJVIPy (ORCPT ); Sat, 22 Oct 2022 04:15:54 -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 610042DAC3B; Sat, 22 Oct 2022 00:56:48 -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 11F1860B1F; Sat, 22 Oct 2022 07:50:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24640C433C1; Sat, 22 Oct 2022 07:50:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425012; bh=dNMunzMMumve21E4L5a/WJb3XjIry962Cna+gvU05lc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wa6XjzgiAyAlVtMU9V9qJOnOUQ+Ixa0054pR71yviIay4uvABqqOxfODBBQ/QjW/K VG113qQx9kL8vFubSbyJezmggllDuzqmwIi8ptSt9/zgmrM3EDZpATq1bcd0gdP99V Omn8ZZbOqWeB9/5l4y5juN+byOFIR/8gV2Vcvq1g= 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 5.19 329/717] ASoC: eureka-tlv320: Hold reference returned from of_find_xxx API Date: Sat, 22 Oct 2022 09:23:28 +0200 Message-Id: <20221022072509.441930545@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376182601321981?= X-GMAIL-MSGID: =?utf-8?q?1747376182601321981?= 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 8b61582753c8..9af4c4a35eb1 100644 --- a/sound/soc/fsl/eukrea-tlv320.c +++ b/sound/soc/fsl/eukrea-tlv320.c @@ -86,7 +86,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) { @@ -143,7 +143,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 | @@ -158,10 +158,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; @@ -178,6 +179,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