From patchwork Thu Jul 27 23:26:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Borneo X-Patchwork-Id: 9867697 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 17C1F601A1 for ; Thu, 27 Jul 2017 23:28:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0ADCA28865 for ; Thu, 27 Jul 2017 23:28:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F38B62886C; Thu, 27 Jul 2017 23:28:05 +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 7C4B028865 for ; Thu, 27 Jul 2017 23:28:05 +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=CMPVIZa6GyqMpM8YQpElgFc4NUQVuxvvGVYM3POjEn8=; b=Or315qantntoBHmg3j17gYCYux 8U23regoxc1REkO+dx9bxzNUZbBpgPt/hLdBaltG5BaURsxColQSaT/Y+Fz9E4VyxKVEY8jtw+iLq nBXnG5HiX0nwtxTBk2mvdRenhKxEe5AHWjqUTa8gZBVc/5XRS8UQ2qff38IZF8IrbcClBovMSM3vp zOvwA0e7LtmMvm/A/rn4R2U26AIo16PxY/be5TDoiJyjL5NTBy+l+eJuWX7I59oRgmWyJYoSHyuBf uEsCw3WtGdOSCkVM/iEa0FMtJBuvznFJR6nU7T3BwPL/pZgfv+//KstK5VCHrmEkcOfJDMZ4LuGsQ b3wk8KNA==; 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 1dasCG-0007zL-JO; Thu, 27 Jul 2017 23:28:00 +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-0007KP-9U 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 y43so25351468wrd.0 for ; Thu, 27 Jul 2017 16:27:16 -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=U2vmu3zGc1ml8YBwBvlUHjWh84zQHskE6Yg6+0rPRuY=; b=Sr4QPxK+hpqo4rxXrsFJPVhpf5+g7Frf4eYqsNhsXbpsjImoFPHWl4EKn452JhSNJ9 GPfiCiaZxH6OVLPrm1zBF6ElT4lLGOIeTcLgEANdoXcEG7MhAU4QmYZE7+p10gioKg5U wtFHUjV+51kuQXy0YCrB+j1/J6x6wSlSSzqNnk+UC4JpOJtKNPMBIQAgoMKWe4VypRE6 8P0m/vnbI/uipO7IIHrP4uYjnQIjevDcyyAvhOxF57BH8rlAQwo7T3IhtL58yaNqn0/r s1RszoalEtuJnMmakeohtLBQxRioWTSveEOq92scXkRPYGkGWskBTOZLI8gzkAxhbqE1 Vfww== 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=U2vmu3zGc1ml8YBwBvlUHjWh84zQHskE6Yg6+0rPRuY=; b=jJKYGRKkgiMeRmYtikFvSQ7n+RymC9bYd9WeiRAyM40m2YliKUf0n+tYoggb4uIYn/ k3YPuzdYez0uxzyuF0bmEMk8M7StiNHXMi2la5nMjbLXjmmNoilpb5V9GIomwGvv6lCN vMQDYR5l0Gy5w7jvlrCUcar7B/CCEzN0F5rt1wlqoA7/NTeZAuMmWbOybumKRoZ9QDuH OEypAli+Bo/ijKsJTqV5GuVsMpUkNQ5gmvWW2enqFOGXY8ObOBhOAp74N4lQ8OnT0x69 g4Wly2rR75tYfKYK7Gv2+vS/qdpKQ8lyfbkDN7JBo09hS9H50arPpOeyvAWZibVVlSdU A9jw== X-Gm-Message-State: AIVw112zoXFF4aIw4eim5cvUa1TQBBeLhUsIaVpzZ2+OKQa+DpWw5Jn6 XEPhnfgAjK/ZeQ== X-Received: by 10.223.169.41 with SMTP id u38mr4954098wrc.286.1501198035493; Thu, 27 Jul 2017 16:27:15 -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.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Jul 2017 16:27:14 -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 2/3] ASoC: soc-core: fix unbalanced of_node_get()/of_node_put() Date: Fri, 28 Jul 2017 01:26:11 +0200 Message-Id: <20170727232612.23543-3-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_485733_CD09C241 X-CRM114-Status: GOOD ( 11.57 ) 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 a180e8b98843 ("ASoC: add snd_soc_get_dai_id() function"). 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/soc-core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 921622a..a0f39de 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -4087,6 +4087,11 @@ int snd_soc_get_dai_id(struct device_node *ep) struct device_node *node; int 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); /*