From patchwork Mon Oct 24 11:30:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8475 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403344wru; Mon, 24 Oct 2022 04:51:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6A9+8SByR1iuY/wiSDlfypAAiXl/45uo+K2/zV3FwDx7PQSKafEqizza7kW/sWVswSZVSv X-Received: by 2002:a17:903:258b:b0:186:8bb2:de32 with SMTP id jb11-20020a170903258b00b001868bb2de32mr11733186plb.63.1666612315922; Mon, 24 Oct 2022 04:51:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612315; cv=none; d=google.com; s=arc-20160816; b=dw4GT6W27Tdj4mhZN9Cd6rbKd/aGHG/Xvz5BHDEXzFJ1b2L8V5vNAg2ZgPWb6UbND5 uArvEFX0uvt698CWeZt9ODtQ2lMw6oe++CND04uOIpMK/CbCK3pFayZ+t+YP13Irk5C8 ouJpV3/YP4d9jmpL8rZo4D4mQ++FVcXmlTgmO4jVeHiDy08Zw1o/9TCMPRwmziZgpzvS dZ6M5a1wzDSCqVlzPYCv+OMczxpgGQWcukCtxv3FoO/fEXQJoqV8X07PCCDKQQFalXgY xT/SKappeKsWr6zw/+/tmE5fhJCI931dh6R6deNyS43xA9kbXjyZJLpsHclf9yW7T1TT eupw== 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=R9d+ZXhPD+95EHWUXoGMbH3w6QAxpRKEu+f2dcUdcAA=; b=Ikv0MfQ2bCyGGuRM/loVV52uMWsyBUzS92+jQvtl901IrJ06n5OXk4l9zE07MF9vmF wjFAVvBtzOxIsAl6+/uSjGYYuvXoB+c5e+fUdTApKKPRqOLBeV15/EQ0HdGApGoUJdKy 9pb5X32XPsPNrFnsmeh08G7llZFx3Z9mUYwbLWNyPJZv1J0r3RTFQKsS7S9zuxu/MH0I a7Oo5gkOvP3E/m7J61jt2nRhyFpKTVwylEIv9dnS7rWImvvO5oh2njDtTVs9QU6LKZPl x/xChaVhV0IyfwT+eBm2W8lWd2H8gyn+5IfPlb7beBUA2qUGzZZYzeCWIH4OgbxBcgXf Ad+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F0KkNXYF; 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 w12-20020a056a0014cc00b0056befaa95a1si1939037pfu.50.2022.10.24.04.51.43; Mon, 24 Oct 2022 04:51:55 -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=F0KkNXYF; 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 S230250AbiJXLvF (ORCPT + 99 others); Mon, 24 Oct 2022 07:51:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231913AbiJXLtN (ORCPT ); Mon, 24 Oct 2022 07:49:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 140D36D877; Mon, 24 Oct 2022 04:43:51 -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 CF9DDB81185; Mon, 24 Oct 2022 11:43:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3980FC433D6; Mon, 24 Oct 2022 11:43:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611812; bh=5dRIdOu21Z2t660M+e7TugsnjlgCx4ggxlqHzOl1Bis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F0KkNXYFpoKiCUe8H1At6qUzcJB61OdbJ0l9THcv/8dOtRnYkuQn/C4G9R11LoqqK 5zrhxbrjdmo0ZtFTGLXPNiIaiuv91+gyDDvuaCivTxbeNvhkybRrTTeRpAnCwpPDiO L8v+oJ6LhgHtYtlaK2wEECwBDVDQkN/8r2K6Y0aM= 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.9 080/159] ASoC: eureka-tlv320: Hold reference returned from of_find_xxx API Date: Mon, 24 Oct 2022 13:30:34 +0200 Message-Id: <20221024112952.351647448@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569675981523975?= X-GMAIL-MSGID: =?utf-8?q?1747569675981523975?= 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 38132143b7d5..10da7fd2d054 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