From patchwork Thu Jul 27 23:26:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Borneo X-Patchwork-Id: 9867699 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A83A3601A1 for ; Thu, 27 Jul 2017 23:28:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9AE7928865 for ; Thu, 27 Jul 2017 23:28:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F8922886C; Thu, 27 Jul 2017 23:28:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 12F2728865 for ; Thu, 27 Jul 2017 23:28:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=BpGX2bQSqD6QEGI1mp/5BfJDLBmMKeVundr+ny+7g9Y=; b=shVBorG0yw3A0KDOspkVjPbzhp cCU309o1oX6kxoEdEyEwJ8JP4AFkY2R+oP50l80fgDsi88l9FfmGfYXWujIL/QvrBNtwvqNx1cAhP SgtuWV3zh0uG0N/Vcr2TSamo32NoPguS9MuNxWW8aP86CIwRm149YK9ftE1ll5dMPTS6kQJTFWGby hW3rxwl2iTno6xb1ExR1C1NZj8BrSqeEFZ81KNM7MmbMCwd89mst0UAhhAwwScYlh17awxJWvFJn7 HKKM7SdijDc/sGno3LpCN4Y0FT2kEPQpBN2V1nWu/2W5ltkiwpP4d6yA/DiIdmu1fcFghJDWa3yiR P63xfgsQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dasCZ-0008He-9q; Thu, 27 Jul 2017 23:28:19 +0000 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dasBt-0007OL-9Y for linux-arm-kernel@lists.infradead.org; Thu, 27 Jul 2017 23:27:39 +0000 Received: by mail-wr0-x242.google.com with SMTP id g32so8122006wrd.5 for ; Thu, 27 Jul 2017 16:27:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=Al5SKR037FpbIfHPnQpIsF4wgoIL5JGwFLMy1M47Blk=; b=p9ZZuZZTOQgTt6oVTjeMUMKVzoVx8M967niTXRy6VfwgFhRm4Nt/g4SUroKabBzfXz b2QCi0g2Sevk+c1ADZ1h7PL6WInqCLD2HYzS/84axtTftvFy1FNshQAY4b+Y0IydnHzH A1Gg82+wwBt/ZZ/RkmTWWiDZcwphGG1QPAyw778f+Zk02ig9OmmqJ7/cW6etonYT3lz2 G2O4HMMD46+UxKTDGZTsIeGfEyJ3Vz6eeAyNMEfHRxeYWqL6vmmK/A7YFuf0Iltug+vM ZpxpLjb7yZCZbFeKijdMc7gy6o8ZiLUiJCSDGDQ+6ly78+sH866Q4AVQZ6PDn0XaU2K6 WvTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=Al5SKR037FpbIfHPnQpIsF4wgoIL5JGwFLMy1M47Blk=; b=RDnOBIdxSiCol1+kpTiGawPfxao9xvurENNkN0xRYeWJR6KAmF01qUYLtMJrzFC7tY wKlufZc8FIyQfk/2LHbhEzY52/MaNt00IJj3m7gcRzmSca1ypN1fc/nij/0b49XfgyvS CROh3Hurdb9vadH0pKsgMuriYFGBWy71Q071rxrZp7FTo+VSX2HAnkKd3GGT1MS6sjt7 +HvfKV9U4pVty+OMMiHqlFf8MR9eB6SrAJ2hAybeM35TbsJ2UewwsDhT+Td8Iz9Jskpk 0hvLZplfhRHR/0iIEYxfvLSXtanXb0dR0HlXrUpSADwXqbx3pA/8KT1ar9WtLJhIv34J O0Yg== X-Gm-Message-State: AIVw112WU3408Ld8eOjLjRZyW6HWg81WasxaQ1+iDjrxMV0+1UNgWv7B EQmQinpcLSUNMg== X-Received: by 10.223.154.7 with SMTP id z7mr4448777wrb.136.1501198038921; Thu, 27 Jul 2017 16:27:18 -0700 (PDT) Received: from localhost.localdomain ([2a01:e34:edb8:72e0:f7c2:bbb1:de32:ba2a]) by smtp.gmail.com with ESMTPSA id t62sm2977044wmb.24.2017.07.27.16.27.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Jul 2017 16:27:17 -0700 (PDT) From: Antonio Borneo X-Google-Original-From: Antonio Borneo To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org Subject: [PATCH v2 3/3] ASoC: simple-card-utils: fix unbalanced of_node_get()/of_node_put() Date: Fri, 28 Jul 2017 01:26:12 +0200 Message-Id: <20170727232612.23543-4-antonio.borneo@st.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170727232612.23543-1-antonio.borneo@st.com> References: <20170727232612.23543-1-antonio.borneo@st.com> In-Reply-To: <20170725214952.6491-1-borneo.antonio@gmail.com> References: <20170725214952.6491-1-borneo.antonio@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170727_162737_490828_E70F72BA X-CRM114-Status: GOOD ( 12.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kuninori Morimoto , linux-kernel@vger.kernel.org, Wei Xu , Antonio Borneo , John Stultz , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Antonio Borneo On Hikey target board, enabling CONFIG_OF_DYNAMIC triggers several errors at kernel boot, like the following one OF: ERROR: Bad of_node_put() on /soc/i2s@f7118000/ports/port@0/endpoint each followed by stack dump. of_graph_get_port_parent() walks through the parents looking for a node named "ports". At each step it uses of_get_next_parent() that drops the current node with of_node_put(). Avoid dropping the initial node by calling of_node_get() before of_graph_get_port_parent(). Tested with kernel v4.13-rc2 with hikey_defconfig taken from https://git.linaro.org/people/john.stultz/android-dev.git branch dev/hikey-mainline-WIP This fixes commit 1689333f8311 ("ASoC: simple-card-utils: add asoc_simple_card_parse_graph_dai()"). Signed-off-by: Antonio Borneo --- To: Liam Girdwood To: Mark Brown To: Jaroslav Kysela To: Takashi Iwai To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org Cc: Wei Xu Cc: John Stultz Cc: linux-arm-kernel@lists.infradead.org Cc: Kuninori Morimoto --- sound/soc/generic/simple-card-utils.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 26d64fa..144954b 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -250,6 +250,11 @@ static int asoc_simple_card_get_dai_id(struct device_node *ep) if (ret != -ENOTSUPP) return ret; + /* + * of_graph_get_port_parent() will call + * of_node_put(). So, call of_node_get() here + */ + of_node_get(ep); node = of_graph_get_port_parent(ep); /*