From patchwork Sat Feb 11 22:59:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 9568207 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 1579660231 for ; Sat, 11 Feb 2017 23:00:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B5DE28558 for ; Sat, 11 Feb 2017 23:00:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F35D828575; Sat, 11 Feb 2017 23:00:53 +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_SIGNED, DKIM_VALID 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 0AB3B28558 for ; Sat, 11 Feb 2017 23:00:52 +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: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:In-Reply-To: References:List-Owner; bh=6ar+QeBSDNKoWDswBNy+63VFlcH9NdADIHkO+q/yLEY=; b=lD8 7zpwMYrS6c8ptRrqzH6hDGowKXPaONx6K6gPYk7wuY9BwSZDZK9N4/jV6AMSI4o7AgqRsft+NkUdO /ySgTQU1umdfZZVdwOloWCXJAoFSAYH3ztHslwEFlqXU6RzXOufHe31/a3jzDRaYm932UvMzhZMHJ HN1fRU44iHguF/yCBpbk+2uDTXEencyYdt5Ob6RaXlCvYkPjpG8WWodnYoI3dYrJOLnM7rgrjFAdU HU2fB6Jz/rs7QDpzmWOq8+CnHYZA1gd8YH9SpV3WcJC3IWvFq2FFKFSQKJpdYgi041CQ1dNDLSP2N TOncYVV5vU4/puSZzy4zd30GGJk7jZw==; 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 1ccgeq-0002Nb-Qo; Sat, 11 Feb 2017 23:00:44 +0000 Received: from bh-25.webhostbox.net ([208.91.199.152]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ccgel-0000nH-NX for linux-arm-kernel@lists.infradead.org; Sat, 11 Feb 2017 23:00:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=Message-Id:Date:Subject:Cc:To:From; bh=mCzwPghPKA2FHadpKPNvWyui1C7n0Gq90I3T8xQ7Ans=; b=0EIB7QJ5Iiu28QtNsR3mpSKzkA 5hBq+23ez1nJ9xM2sSFvPuOxce3i4KYXv0dZArn5+u4pOzIvnFbzoVUlq5Fb7lsVit6s8kBJvDAHI AqDBt/3fxfH97FR9sh7LEyk1i+jqn7NUdxos57yVPHAoTvfPpKYG9TNXS8VoFMgQH3TH7MLUXvNGd 2Wt2uhPfTyAC66maAF3wp2InJJjTaWe1oBbT6eWSiGcZE01yB2dx3EGAwI9Z3yIwShTToJ+efuM7S EMhlOIX/qs0a9sGRlIETTY6PTDCnCOUnUxCEZc5uWLByUmB0cVCDBN0RqtIlh1zjOfhkSgrl+YBhb vZXD+xjQ==; Received: from 108-223-40-66.lightspeed.sntcca.sbcglobal.net ([108.223.40.66]:55866 helo=localhost) by bh-25.webhostbox.net with esmtpa (Exim 4.86_1) (envelope-from ) id 1ccgdK-002jSH-Qr; Sat, 11 Feb 2017 22:59:11 +0000 From: Guenter Roeck To: Paul Walmsley Subject: [PATCH] ARM: OMAP2+: Grab reference to device nodes where needed Date: Sat, 11 Feb 2017 14:59:08 -0800 Message-Id: <1486853948-20978-1-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.7.4 X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - lists.infradead.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170211_150039_893814_CBD4B52A X-CRM114-Status: UNSURE ( 9.58 ) X-CRM114-Notice: Please train this message. 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: Rob Herring , Tony Lindgren , Russell King , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, Peter Rosin , Guenter Roeck , Qi Hou 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 After commit 'of: fix of_node leak caused in of_find_node_opts_by_path', the following error may be reported when running omap images. OF: ERROR: Bad of_node_put() on /ocp@68000000 CPU: 0 PID: 0 Comm: swapper Not tainted 4.10.0-rc7-next-20170210 #1 Hardware name: Generic OMAP3-GP (Flattened Device Tree) [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (dump_stack+0x98/0xac) [] (dump_stack) from [] (kobject_release+0x48/0x7c) [] (kobject_release) from [] (of_find_node_by_name+0x74/0x94) [] (of_find_node_by_name) from [] (omap3xxx_hwmod_is_hs_ip_block_usable+0x24/0x2c) [] (omap3xxx_hwmod_is_hs_ip_block_usable) from [] (omap3xxx_hwmod_init+0x180/0x274) [] (omap3xxx_hwmod_init) from [] (omap3_init_early+0xa0/0x11c) [] (omap3_init_early) from [] (omap3430_init_early+0x8/0x30) [] (omap3430_init_early) from [] (setup_arch+0xc04/0xc34) [] (setup_arch) from [] (start_kernel+0x68/0x38c) [] (start_kernel) from [<8020807c>] (0x8020807c) of_find_node_by_name() drops the reference to the passed device node, so it is necessary to grab an extra one if it is still needed after the call. Cc: Qi Hou Cc: Peter Rosin Cc: Rob Herring Signed-off-by: Guenter Roeck --- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index 56f917ec8621..d4ca1e3964c3 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -3117,6 +3117,7 @@ static int __init omap3xxx_hwmod_is_hs_ip_block_usable(struct device_node *bus, if (!bus) return (omap_type() == OMAP2_DEVICE_TYPE_GP) ? 1 : 0; + of_node_get(bus); if (of_device_is_available(of_find_node_by_name(bus, dev_name))) return 1; @@ -3189,15 +3190,20 @@ int __init omap3xxx_hwmod_init(void) if (h_sham && omap3xxx_hwmod_is_hs_ip_block_usable(bus, "sham")) { r = omap_hwmod_register_links(h_sham); - if (r < 0) + if (r < 0) { + of_node_put(bus); return r; + } } if (h_aes && omap3xxx_hwmod_is_hs_ip_block_usable(bus, "aes")) { r = omap_hwmod_register_links(h_aes); - if (r < 0) + if (r < 0) { + of_node_put(bus); return r; + } } + of_node_put(bus); /* * Register hwmod links specific to certain ES levels of a