From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753771AbcDOKui (ORCPT ); Fri, 15 Apr 2016 06:50:38 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:38350 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751618AbcDOKsl (ORCPT ); Fri, 15 Apr 2016 06:48:41 -0400 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com u3FAlUxh031394 X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: arm@kernel.org Cc: Masahiro Yamada , Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] ARM: uniphier: correct the call order of of_node_put() Date: Fri, 15 Apr 2016 19:48:29 +0900 Message-Id: <1460717309-3982-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Put nodes after of_address_to_resource() in case the nodes might be released while parsing in them. Signed-off-by: Masahiro Yamada --- arch/arm/mach-uniphier/platsmp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-uniphier/platsmp.c b/arch/arm/mach-uniphier/platsmp.c index db04142..e802ca8 100644 --- a/arch/arm/mach-uniphier/platsmp.c +++ b/arch/arm/mach-uniphier/platsmp.c @@ -99,16 +99,16 @@ static int __init uniphier_smp_prepare_trampoline(unsigned int max_cpus) int ret; np = of_find_compatible_node(NULL, NULL, "socionext,uniphier-smpctrl"); - of_node_put(np); ret = of_address_to_resource(np, 0, &res); + of_node_put(np); if (!ret) { rom_rsv2_phys = res.start + UNIPHIER_SMPCTRL_ROM_RSV2; } else { /* try old binding too */ np = of_find_compatible_node(NULL, NULL, "socionext,uniphier-system-bus-controller"); - of_node_put(np); ret = of_address_to_resource(np, 1, &res); + of_node_put(np); if (ret) { pr_err("failed to get resource of SMP control\n"); return ret; -- 1.9.1