From patchwork Wed Oct 19 08:27:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4836 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223685wrs; Wed, 19 Oct 2022 02:38:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4b84cEek3ybaXocujUfrTZJMDh1Hb/S9GfMlTcmQSt9Gf+2qNZuICy+wBUeNI/Kwo7lpSD X-Received: by 2002:a17:907:3e01:b0:730:a690:a211 with SMTP id hp1-20020a1709073e0100b00730a690a211mr5922653ejc.596.1666172291347; Wed, 19 Oct 2022 02:38:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172291; cv=none; d=google.com; s=arc-20160816; b=dAqaKsFyBsxhhJ0sZHY0y5TiZGaZ/+FlSJUAiIfVrCNO5bVON9au5yi0Rf/sdytQb/ tFQhYS/Qle5Q1ke92qW7CZQ/fSY6ppd/QVbfe8yLtVvpGaXtcWgcgmokfC7Nko14F3fj yNv52PJlm/F8CqVMjuhcovxAPAzWXhtZwHQCqFNUziBWO2JdqUQbqIy0BcNoguh/HVkf WvDip0jt7JOIBhvRY6KAhXbAUkxef+KHofdjpO8wdIlsuEnQE1FDtk/1pkwcmESu3Ahl YUyhvQdTcinavgAfet7ydYo2/XRzadO2kk7IDcJHqghJZLVLaNe+uN0fxmqraC5vF0Qq gdhQ== 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=sxOVfW3OOYlrHFp/3hRY0qR7oFsNDMVWW28wMCNGdRMsWPEUseAcsezyPR+dl/NyPw 8i5DwhSaAVCRrFQoGO0w6nBiOq+KlWTx2VIBnGUgh2EiUujbcGRUxpNPHv49E6DJdBJY T69ACFFhXxFtDukYxBT4FPtht2kqCufn/DHzMe3vj/leKwQMKql0JBtJFiYTgcLo9SEI 4/PJBk4R0X+Li4lGFs6NPD/lXUX1GjNQnGgs8uUYT5V+ABOLPR9AbZOmE5cfUw8y+QD7 OGZF/0j5346nXKr+dcdzRg5loUV87bmbAoiKcgkRjMCVYqKXOL4vYPwgJgmHLxqcKz38 9D5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rMcApPyN; 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 f13-20020a0564021e8d00b0045d4a88c735si12811214edf.220.2022.10.19.02.37.43; Wed, 19 Oct 2022 02:38:11 -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=rMcApPyN; 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 S233386AbiJSJVI (ORCPT + 99 others); Wed, 19 Oct 2022 05:21:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233655AbiJSJTu (ORCPT ); Wed, 19 Oct 2022 05:19:50 -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 1670EDEF0D; Wed, 19 Oct 2022 02:09:09 -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 E041D6174E; Wed, 19 Oct 2022 08:55:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C67FAC433C1; Wed, 19 Oct 2022 08:55:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169740; bh=dNMunzMMumve21E4L5a/WJb3XjIry962Cna+gvU05lc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rMcApPyNEP9J1t6y4WeQmsji6DiNXW1DDnVkXGcfPNAGAtN5jF1nsrPKWyKB4NOX8 CEagxIW5zvg66zC1NN2vHJxizX1mXOMkJ6VlIKaEqdRuAHij8VpqhWLdSWr8CvKFqM 6k1597u6Jz9V/vdv1J5eAYyaOohEN7dgrjcSU7tI= 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 6.0 391/862] ASoC: eureka-tlv320: Hold reference returned from of_find_xxx API Date: Wed, 19 Oct 2022 10:27:58 +0200 Message-Id: <20221019083307.220188469@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747108276636788258?= X-GMAIL-MSGID: =?utf-8?q?1747108276636788258?= 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