From patchwork Thu Feb 21 01:07:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 2170231 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 CBEE8DF230 for ; Thu, 21 Feb 2013 02:12:30 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U8Las-0004yw-2G; Thu, 21 Feb 2013 02:09:06 +0000 Received: from db3ehsobe001.messaging.microsoft.com ([213.199.154.139] helo=db3outboundpool.messaging.microsoft.com) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1U8Lap-0004yW-BK for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2013 02:09:04 +0000 Received: from mail87-db3-R.bigfish.com (10.3.81.252) by DB3EHSOBE010.bigfish.com (10.3.84.30) with Microsoft SMTP Server id 14.1.225.23; Thu, 21 Feb 2013 02:08:53 +0000 Received: from mail87-db3 (localhost [127.0.0.1]) by mail87-db3-R.bigfish.com (Postfix) with ESMTP id D568C20221; Thu, 21 Feb 2013 02:08:53 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1f42h1ee6h1de0h1202h1e76h1d1ah1d2ahzz8275bhz2dh2a8h668h839he5bhf0ah107ah11b5h121eh1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h14afh1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1155h) Received: from mail87-db3 (localhost.localdomain [127.0.0.1]) by mail87-db3 (MessageSwitch) id 1361412531476021_20206; Thu, 21 Feb 2013 02:08:51 +0000 (UTC) Received: from DB3EHSMHS004.bigfish.com (unknown [10.3.81.231]) by mail87-db3.bigfish.com (Postfix) with ESMTP id 7163816007B; Thu, 21 Feb 2013 02:08:51 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB3EHSMHS004.bigfish.com (10.3.87.104) with Microsoft SMTP Server (TLS) id 14.1.225.23; Thu, 21 Feb 2013 02:08:50 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server (TLS) id 14.2.328.11; Thu, 21 Feb 2013 02:08:47 +0000 Received: from shlinux1.ap.freescale.net (shlinux1.ap.freescale.net [10.192.225.216]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id r1L28l56032115; Wed, 20 Feb 2013 19:08:48 -0700 Received: by shlinux1.ap.freescale.net (Postfix, from userid 1013) id 447281AE0CC; Thu, 21 Feb 2013 09:07:29 +0800 (CST) From: Frank Li To: , , , Subject: [PATCH 1/1] net: fec: fix crash at mx53 qsb board Date: Thu, 21 Feb 2013 09:07:28 +0800 Message-ID: <1361408848-14118-1-git-send-email-Frank.Li@freescale.com> X-Mailer: git-send-email 1.7.1 MIME-Version: 1.0 X-OriginatorOrg: freescale.net X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130220_210903_614489_95BD7881 X-CRM114-Status: GOOD ( 15.42 ) 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 [213.199.154.139 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: festevam@gmail.com, s.hauer@pengutronix.de, shawn.guo@linaro.org, B38611@freescale.com, Frank Li 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 Unable to handle kernel NULL pointer dereference at virtual address 00000002 pgd = 80004000 [00000002] *pgd=00000000 Internal error: Oops: 5 [#1] SMP ARM Modules linked in: CPU: 0 Not tainted (3.8.0-rc7-next-20130215+ #346) PC is at fec_enet_interrupt+0xd0/0x348 LR is at fec_enet_interrupt+0xb8/0x348 pc : [<80372b7c>] lr : [<80372b64>] psr: 60000193 sp : df855c20 ip : df855c20 fp : df855c74 r10: 00000516 r9 : 1c000000 r8 : 00000000 r7 : 00000000 r6 : 00000000 r5 : 00000000 r4 : df9b7800 r3 : df9b7df4 r2 : 00000000 r1 : 00000000 r0 : df9b7d34 It is possible that issue a irq between request_irq and fec_enet_init. Irq handle will be called but driver data structure is not ready yet. Signed-off-by: Frank Li Tested-by: Fabio Estevam --- drivers/net/ethernet/freescale/fec.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c index 7c6e890..a860486 100644 --- a/drivers/net/ethernet/freescale/fec.c +++ b/drivers/net/ethernet/freescale/fec.c @@ -1676,7 +1676,6 @@ static int fec_enet_init(struct net_device *ndev) ndev->netdev_ops = &fec_netdev_ops; ndev->ethtool_ops = &fec_enet_ethtool_ops; - writel(FEC_RX_DISABLED_IMASK, fep->hwp + FEC_IMASK); netif_napi_add(ndev, &fep->napi, fec_enet_rx_napi, FEC_NAPI_WEIGHT); /* Init enet descriptors */ @@ -1786,6 +1785,13 @@ fec_probe(struct platform_device *pdev) fep->pdev = pdev; fep->dev_id = dev_id++; + /* + * disable and clean all irq to avoid unexpected irq happen + * between init driver data structure and request_irq + */ + writel(0, fep->hwp + FEC_IMASK); + writel(0xFFFFFFFF, fep->hwp + FEC_IEVENT); + fep->bufdesc_ex = 0; if (!fep->hwp) {