From patchwork Wed Jan 14 10:50:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 5630061 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 72E649F50F for ; Wed, 14 Jan 2015 10:51:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8DBC3203AA for ; Wed, 14 Jan 2015 10:51:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EBDEC203A1 for ; Wed, 14 Jan 2015 10:51:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751592AbbANKu5 (ORCPT ); Wed, 14 Jan 2015 05:50:57 -0500 Received: from albert.telenet-ops.be ([195.130.137.90]:56103 "EHLO albert.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751571AbbANKuy (ORCPT ); Wed, 14 Jan 2015 05:50:54 -0500 Received: from ayla.of.borg ([84.193.93.87]) by albert.telenet-ops.be with bizsmtp id fmqo1p00g1t5w8s06mqo3z; Wed, 14 Jan 2015 11:50:53 +0100 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.82) (envelope-from ) id 1YBLXE-0002WU-Cq; Wed, 14 Jan 2015 11:50:48 +0100 Received: from geert by ramsan with local (Exim 4.82) (envelope-from ) id 1YBLXI-0003xp-25; Wed, 14 Jan 2015 11:50:52 +0100 From: Geert Uytterhoeven To: Simon Horman , Magnus Damm Cc: linux-sh@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] ARM: shmobile: R-Mobile: Fix DT refcount bugs in PM domain code Date: Wed, 14 Jan 2015 11:50:48 +0100 Message-Id: <1421232648-15204-1-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 1.9.1 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix two DT refcount imbalances in the PM domain code that scans the DT topology: 1. Add missing of_node_put() after of_find_compatible_node(). 2. If CONFIG_OF_DYNAMIC=y: ERROR: Bad of_node_put() on /system-controller@e6180000 of_find_node_by_name() calls of_node_put() on its "from" parameter, which must not be done on the for_each_compatible_node() iterator, as it causes a zero refcount later. Use of_get_child_by_name() instead to fix this. Signed-off-by: Geert Uytterhoeven --- Fixes: d7a3a10c8391fdcd ("ARM: shmobile: R-Mobile: Add DT support for PM domains") in Simon's git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git tag renesas-dt-pm-for-v3.20 --- arch/arm/mach-shmobile/pm-rmobile.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c index 07fb4ea4d8e94258..85a7fdd9823bc5a6 100644 --- a/arch/arm/mach-shmobile/pm-rmobile.c +++ b/arch/arm/mach-shmobile/pm-rmobile.c @@ -270,8 +270,10 @@ static void __init get_special_pds(void) /* PM domain containing Coresight-ETM */ np = of_find_compatible_node(NULL, NULL, "arm,coresight-etm3x"); - if (np) + if (np) { debug_pd = of_parse_phandle(np, "power-domains", 0); + of_node_put(np); + } } static void __init put_special_pds(void) @@ -363,7 +365,7 @@ static int __init rmobile_init_pm_domains(void) continue; } - pmd = of_find_node_by_name(np, "pm-domains"); + pmd = of_get_child_by_name(np, "pm-domains"); if (!pmd) { pr_warn("%s lacks pm-domains node\n", np->full_name); continue;