From patchwork Fri Nov 9 00:17:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hunter, Jon" X-Patchwork-Id: 1718291 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id F3AA1DF280 for ; Fri, 9 Nov 2012 00:19:17 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TWcHs-0001Ni-E8; Fri, 09 Nov 2012 00:17:32 +0000 Received: from devils.ext.ti.com ([198.47.26.153]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TWcHo-0001NN-AT for linux-arm-kernel@lists.infradead.org; Fri, 09 Nov 2012 00:17:29 +0000 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id qA90HQUG006188; Thu, 8 Nov 2012 18:17:26 -0600 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id qA90HQTu022961; Thu, 8 Nov 2012 18:17:26 -0600 Received: from dlelxv24.itg.ti.com (172.17.1.199) by dfle73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.1.323.3; Thu, 8 Nov 2012 18:17:26 -0600 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlelxv24.itg.ti.com (8.13.8/8.13.8) with ESMTP id qA90HQ9Q014931; Thu, 8 Nov 2012 18:17:26 -0600 Received: from localhost (ula0741266.am.dhcp.ti.com [192.157.144.139]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id qA90HPw14149; Thu, 8 Nov 2012 18:17:25 -0600 (CST) From: Jon Hunter To: Tony Lindgren Subject: [PATCH] ARM: OMAP: Fix kernel panic in dmtimer probe Date: Thu, 8 Nov 2012 18:17:23 -0600 Message-ID: <1352420243-31803-1-git-send-email-jon-hunter@ti.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121108_191728_516055_B2BF536B X-CRM114-Status: GOOD ( 15.43 ) X-Spam-Score: -7.6 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [198.47.26.153 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-omap , Jon Hunter , linux-arm X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org When booting with device-tree the kernel is panicing in the probe of the DMTIMER driver. The panic is caused because the pointer to platform_data structure is NULL when booting with device-tree and the driver is attempting to access the structure without checking if the pointer is valid. Fix this by moving the code that accesses the platform data structure under the "else" clause of the "if (dev->of_node)" statement because here the pointer to platform_data is guaranteed to be valid. The code accessing the "timer_capability" member of the platform data is simply removed as this is already handled under the else clause. This regression was introduced while integrating commit "ARM: OMAP: Add DT support for timer driver" to add device-tree support to the DMTIMER driver and commit "ARM: OMAP: Move omap-pm-noop.c local to mach-omap2" to prepare for single zImage support. Signed-off-by: Jon Hunter Reported-by: Tony Lindgren --- arch/arm/plat-omap/dmtimer.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c index 38c12ef..9dca23e 100644 --- a/arch/arm/plat-omap/dmtimer.c +++ b/arch/arm/plat-omap/dmtimer.c @@ -799,12 +799,11 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev) timer->id = pdev->id; timer->capability = pdata->timer_capability; timer->reserved = omap_dm_timer_reserved_systimer(timer->id); + timer->get_context_loss_count = pdata->get_context_loss_count; } timer->irq = irq->start; timer->pdev = pdev; - timer->capability = pdata->timer_capability; - timer->get_context_loss_count = pdata->get_context_loss_count; /* Skip pm_runtime_enable for OMAP1 */ if (!(timer->capability & OMAP_TIMER_NEEDS_RESET)) {