From patchwork Thu Jul 27 23:26:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Borneo X-Patchwork-Id: 9867693 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 C9EC8601A1 for ; Thu, 27 Jul 2017 23:27:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC8E828865 for ; Thu, 27 Jul 2017 23:27:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B16152886C; Thu, 27 Jul 2017 23:27:45 +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=unavailable 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 4478E28865 for ; Thu, 27 Jul 2017 23:27:45 +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=JRkzsADaFrKVH7eWv5n/uPN1UkHlPe57sGVa7R9zHMc=; b=XIDU7DnmwB7tRyKKBfo/JaLROV 6GhqJwOwGTFiGyNbNRtZThrbz7XwCalr2Epc2IP+8HMCbvJPG++3cE7GJh+V3dU5zZMNtnY7Q6C2w MaqvHnRyVWyr9lA2IAHskrTx/YdI8YYTHlLFjod6b02aUclRvjyR3HZSvo60ziQNqpKijJulN3kuQ E7IaW8tDNZLCRbZJPDutZzywY3w1Tr+qjgtZLf2NAHQmv2d6Ca8aof87tghip1lLsMoB3rsmLuhvu WhRBtSYcgkjm6IB58MOvT+Raef4cOYlR5vx4BclZJ1NmnEDl5AoD4TtYp/RN6aWQ8h7mOfX9eRryM CyAtUYhA==; 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 1dasBv-0007hE-LW; Thu, 27 Jul 2017 23:27:39 +0000 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dasBq-0007KE-N4 for linux-arm-kernel@lists.infradead.org; Thu, 27 Jul 2017 23:27:36 +0000 Received: by mail-wr0-x243.google.com with SMTP id o33so17888370wrb.1 for ; Thu, 27 Jul 2017 16:27:13 -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=J5dNrZ9h8wfNziT2qDJWyCb4IlzGP7iGWWgLhSFw+K8=; b=mnpo/X0cv7H5TsdEKuuKg/hi6ZzHvVTrDO1dN0PzfG/wdLOjKByhMc6BuIzk5SgQFI 9KsXmCyWCXMsMBhI6T1AHaZH2AN+/jox6lNG46+cWA7g61r9H+cwZDpHE210FcMRDt6c +Lpu4ADKXpL4Ck4ywHom6S3gmAtfxwQUkJ2PQ791Va5+SFxITWtX2Bj6mz+kot4bOqZO xL0SGOjkuvIq0rdks/3CfyKog+iCIxAb0SegAcoj4BOUCNXIDnxNKGpwAUYGD30EOhRs Tnb1kwUlUTz0l9vXQb9OZwWX3fxuRSUzeCZGk7w/pea6VRj0WIkA69PR/rU8nsgOAku1 MmBw== 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=J5dNrZ9h8wfNziT2qDJWyCb4IlzGP7iGWWgLhSFw+K8=; b=ROh4xlp665zmPQLTNfvNLq+ggLwHM8xZr618Ck8VWsBnbabPb5pjr9WMWLHpyHewwp 4eqawPKM/MG8w7S14D4xC+yjI4dA14euq/joWDou1RCqDs52jejM7kMwrzh30rP6l/Bu JeE1xRyrHh81Y6q2akDg/IrSzHicjF2JFRNGne6KxDNPbXAnuqQbO8JQ7DO/M3qe8vbp MzP/AsYP/H/IcHNQTSHqZV+RKSLzQGGFJv9HJYbSxAscBVEbtTCLOcXsRLQeLpFNOHEP dcIXNgEkW5U1BvdUUV/OMs+NH2VehsqGnPFbv1b4k0dSLNkj1VB/kWmTmQ7VasWi6otf rjug== X-Gm-Message-State: AIVw1123e7YZAu4wG3KY0wbL0CvC5HpyApomUWWOWzKaMdZrcjCner6K ARGWlDfVPQym5g== X-Received: by 10.223.154.203 with SMTP id a69mr4695199wrc.139.1501198032466; Thu, 27 Jul 2017 16:27:12 -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.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Jul 2017 16:27:11 -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 1/3] ASoC: fix use of of_node_put() in of_for_each_phandle() loops Date: Fri, 28 Jul 2017 01:26:10 +0200 Message-Id: <20170727232612.23543-2-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_162735_098155_4F370A25 X-CRM114-Status: GOOD ( 14.37 ) 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 each followed by stack dump. Each iteration of of_for_each_phandle(){} already provides the needed of_node_put(); adding one more in the body of the loop triggers the error. Fixed by removing the wrong of_node_put(), but adding it when the loop is break out. 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 2692c1c63c29 ("ASoC: add audio-graph-card support"). 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/audio-graph-card.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index 105ec3a..20c2029 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -224,9 +224,10 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv) of_for_each_phandle(&it, rc, node, "dais", NULL, 0) { ret = asoc_graph_card_dai_link_of(it.node, priv, idx++); - of_node_put(it.node); - if (ret < 0) + if (ret < 0) { + of_node_put(it.node); return ret; + } } return asoc_simple_card_parse_card_name(card, NULL); @@ -239,10 +240,8 @@ static int asoc_graph_get_dais_count(struct device *dev) int count = 0; int rc; - of_for_each_phandle(&it, rc, node, "dais", NULL, 0) { + of_for_each_phandle(&it, rc, node, "dais", NULL, 0) count++; - of_node_put(it.node); - } return count; }