From patchwork Wed Aug 6 15:32:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 4687071 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BDB329F375 for ; Wed, 6 Aug 2014 15:35:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CD1DF20160 for ; Wed, 6 Aug 2014 15:35:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 89EAA2015A for ; Wed, 6 Aug 2014 15:35:04 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XF3DE-00077w-Pd; Wed, 06 Aug 2014 15:33:12 +0000 Received: from mail-out.m-online.net ([212.18.0.9]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XF3D9-0006tT-RD for linux-arm-kernel@lists.infradead.org; Wed, 06 Aug 2014 15:33:09 +0000 Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3hSxff6jhGz3hhnq; Wed, 6 Aug 2014 17:32:42 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 3hSxff6Jwdz7S6Rm; Wed, 6 Aug 2014 17:32:42 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.180]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new, port 10024) with ESMTP id Ed37BqEjjiRd; Wed, 6 Aug 2014 17:32:40 +0200 (CEST) X-Auth-Info: xkGyjgT+T65JSGWFObef0Rg8lzcaMn5hrFJ/WKV4GW8= Received: from [192.168.2.247] (88-149-182-160.v4.ngi.it [88.149.182.160]) by smtp-auth.mnet-online.de (Postfix) with ESMTPA; Wed, 6 Aug 2014 17:32:40 +0200 (CEST) Message-ID: <53E24A99.2020604@denx.de> Date: Wed, 06 Aug 2014 17:32:41 +0200 From: Stefano Babic User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: Nathan Lynch , Martin Fuzzey Subject: Re: [Regression] FEC: Panic on suspend in 3.16 References: <53E24147.4050304@parkeon.com> <53E24525.2020809@mentor.com> In-Reply-To: <53E24525.2020809@mentor.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140806_083308_223080_7B6CBFA1 X-CRM114-Status: GOOD ( 22.90 ) X-Spam-Score: -0.0 (/) Cc: netdev@vger.kernel.org, festevam@gmail.com, "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Nathan, Martin, On 06/08/2014 17:09, Nathan Lynch wrote: > On 08/06/2014 09:52 AM, Martin Fuzzey wrote: >> Hi all, >> >> I am using the fec ethernet driver on a i.MX53 SoC. >> >> All was working fine on 3.13 but, after upgrading to 3.16 I now get a >> panic on suspend: > > Same issue reported here: > > http://lists.infradead.org/pipermail/linux-arm-kernel/2014-August/277728.html > > a71e3c37960c (net: phy: Set the driver when registering an MDIO bus > device) has been implicated; try reverting that. > I confirm this issue (on a i.MX35). The ndev pointer is NULL in the suspend function. I added the check for the pointer: From 82af51e87b78000c0e038db6056c34f72a1f4045 Mon Sep 17 00:00:00 2001 From: Stefano Babic Date: Wed, 6 Aug 2014 16:37:58 +0200 Subject: [PATCH] net: fec: check for pointer in suspend/resume Check to get a valid structure to driver data in suspend/resume functions before accessing. Signed-off-by: Stefano Babic --- drivers/net/ethernet/freescale/fec_main.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 77037fd..0f5f52f 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -2659,7 +2659,12 @@ static int fec_suspend(struct device *dev) { struct net_device *ndev = dev_get_drvdata(dev); - struct fec_enet_private *fep = netdev_priv(ndev); + struct fec_enet_private *fep; + + if (!ndev) + return 0; + + fep = netdev_priv(ndev); if (netif_running(ndev)) { fec_stop(ndev); @@ -2678,9 +2683,13 @@ static int fec_resume(struct device *dev) { struct net_device *ndev = dev_get_drvdata(dev); - struct fec_enet_private *fep = netdev_priv(ndev); + struct fec_enet_private *fep; int ret; + if (!ndev) + return 0; + + fep = netdev_priv(ndev); if (fep->reg_phy) { ret = regulator_enable(fep->reg_phy); if (ret)