From patchwork Tue Dec 10 19:16:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 299646 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from casper.infradead.org (unknown [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6CF562C0316 for ; Wed, 11 Dec 2013 11:20:07 +1100 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VqSo6-0005Sl-E2; Tue, 10 Dec 2013 19:17:23 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VqSnm-0002MQ-J7; Tue, 10 Dec 2013 19:17:02 +0000 Received: from mail-wi0-f169.google.com ([209.85.212.169]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VqSnP-0002HJ-1y for linux-arm-kernel@lists.infradead.org; Tue, 10 Dec 2013 19:16:40 +0000 Received: by mail-wi0-f169.google.com with SMTP id hn6so5834808wib.0 for ; Tue, 10 Dec 2013 11:16:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=j8oR0CUKWBFLmu6B3mmahA3WiHdiVeoTwDi26OO56Kw=; b=MwkAJRbvQd/RQa+V+bMFYJHpdIa6y4ytFAs/qOdQaE5vDV9knzRriZ3NyqZcJMqHy3 Y5U7OD2YehNVnNnwMaP6G35DCa7B8wGi4cum5IeUqR/D1twUuYNlZwgWAh6LSYve8Lb3 Qp+4ODqORXj+fUQ+Yvuy0lMN8aMHpEaFXeJduCDuxpPre8YSPPK3Ag3+Q5KNAMyzQIZf XeIUUvgbhwpRwk77E178VWicYijAZFWrnrZ8ci5hqqj6ZgNWAfduH7TcMFyTKWPnHC8G Zzy1kLCqZGiwOPkD7WJXKvLPSvCS8FIn//yWBzP/AXZUeqNbSQqFumSuNykahtnY3+6R mrZQ== X-Gm-Message-State: ALoCoQlkVVlnp3qrNPtv3pduk/JbkKak96iRjVDAFlzxm5AYH926P2W/ylreTD7gny+wEPbG273q X-Received: by 10.194.5.7 with SMTP id o7mr22600277wjo.17.1386702976353; Tue, 10 Dec 2013 11:16:16 -0800 (PST) Received: from localhost.localdomain (AToulouse-654-1-288-187.w90-5.abo.wanadoo.fr. [90.5.191.187]) by mx.google.com with ESMTPSA id xn17sm7758084wib.1.2013.12.10.11.16.14 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Dec 2013 11:16:15 -0800 (PST) From: Daniel Lezcano To: mingo@kernel.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/6] clocksource: clksrc-of: Do not drop unheld reference on device node Date: Tue, 10 Dec 2013 20:16:09 +0100 Message-Id: <1386702972-25565-3-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1386702972-25565-1-git-send-email-daniel.lezcano@linaro.org> References: <52A767CB.3010501@linaro.org> <1386702972-25565-1-git-send-email-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131210_141639_257986_1483B574 X-CRM114-Status: GOOD ( 13.48 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.169 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org From: Thierry Reding When booting a recent kernel on ARM with OF_DYNAMIC enabled, the kernel warns about the following: [ 0.000000] ERROR: Bad of_node_put() on /timer@50004600 [ 0.000000] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.12.0-rc5-next-20131017-00077-gedfd827-dirty #406 [ 0.000000] [] (unwind_backtrace+0x0/0xf4) from [] (show_stack+0x10/0x14) [ 0.000000] [] (show_stack+0x10/0x14) from [] (dump_stack+0x9c/0xc8) [ 0.000000] [] (dump_stack+0x9c/0xc8) from [] (of_node_release+0x90/0x9c) [ 0.000000] [] (of_node_release+0x90/0x9c) from [] (of_find_matching_node_and_match+0x78/0xb4) [ 0.000000] [] (of_find_matching_node_and_match+0x78/0xb4) from [] (clocksource_of_init+0x60/0x70) [ 0.000000] [] (clocksource_of_init+0x60/0x70) from [] (start_kernel+0x1f4/0x33c) [ 0.000000] [] (start_kernel+0x1f4/0x33c) from [<80008074>] (0x80008074) This is caused by clocksource_of_init() dropping a reference on the device node that it never took. The reference taken by the loop is implicitly dropped on subsequent iterations. See the implementation of and the comment on top of the of_find_matching_node_and_match() function for reference (no pun intended). Signed-off-by: Thierry Reding Signed-off-by: Daniel Lezcano Cc: Uwe Kleine-König --- drivers/clocksource/clksrc-of.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/clocksource/clksrc-of.c b/drivers/clocksource/clksrc-of.c index 35639cf4..b9ddd9e 100644 --- a/drivers/clocksource/clksrc-of.c +++ b/drivers/clocksource/clksrc-of.c @@ -35,6 +35,5 @@ void __init clocksource_of_init(void) init_func = match->data; init_func(np); - of_node_put(np); } }