From patchwork Tue May 20 10:11:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sekhar Nori X-Patchwork-Id: 30416 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f198.google.com (mail-vc0-f198.google.com [209.85.220.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4BF45202FE for ; Tue, 20 May 2014 10:12:17 +0000 (UTC) Received: by mail-vc0-f198.google.com with SMTP id ij19sf690163vcb.1 for ; Tue, 20 May 2014 03:12:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :mime-version:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe:content-type; bh=dMfL0odQzq+Uh1jI/DldTrWGlccJcgVQVGYrt6h0NpY=; b=eaMMYneKLDJkN4grLENaVO1JQA2I3r2plLDy6r0yjOoJC7vA+dMpItpLx1dHvpCxPo 540KdM6p7CobzOFYUTLnO7L5B+lf+m09GKmPunkiiq/HDA4kSguMobE7tcXPl+NNPims vFQq7TIPlvDq8cCJYzAOCDs5kVZxuOMSQeQFfSfZ3PtkrlLPr5NyTRDUDniT5/QW5MvV LYZMNAKPb5x79ka1FpSXzaTacQza0WodPyWHh+Uj9CJgC+wPWp29V1vhXL+iXMlrFJor X5igl3X/Fx2FFCMPrYknL5hFxBIhsDICbbmG1/0Z7WcGm7xIAmCokllkvQZ1nJHT2FN6 HS/g== X-Gm-Message-State: ALoCoQk2SAotMPEJlOMEPjlHk2oLwvasdIBV0ZC1PlEiB2GKEcB48V8skIGPojtP+1UWiaF1G0il X-Received: by 10.58.46.146 with SMTP id v18mr14038158vem.2.1400580736840; Tue, 20 May 2014 03:12:16 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.87.33 with SMTP id q30ls207073qgd.10.gmail; Tue, 20 May 2014 03:12:16 -0700 (PDT) X-Received: by 10.52.124.66 with SMTP id mg2mr79844vdb.50.1400580736709; Tue, 20 May 2014 03:12:16 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id p8si4830814vef.68.2014.05.20.03.12.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 May 2014 03:12:16 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id ij19so299920vcb.28 for ; Tue, 20 May 2014 03:12:16 -0700 (PDT) X-Received: by 10.58.29.16 with SMTP id f16mr23861621veh.23.1400580736613; Tue, 20 May 2014 03:12:16 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp17643vcb; Tue, 20 May 2014 03:12:16 -0700 (PDT) X-Received: by 10.66.142.233 with SMTP id rz9mr49917267pab.71.1400580735871; Tue, 20 May 2014 03:12:15 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yr5si23913558pab.84.2014.05.20.03.12.15; Tue, 20 May 2014 03:12:15 -0700 (PDT) Received-SPF: none (google.com: netdev-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751887AbaETKML (ORCPT + 3 others); Tue, 20 May 2014 06:12:11 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:38835 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751755AbaETKMK (ORCPT ); Tue, 20 May 2014 06:12:10 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id s4KAC74B031585; Tue, 20 May 2014 05:12:07 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s4KAC7Pq026183; Tue, 20 May 2014 05:12:07 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Tue, 20 May 2014 05:12:07 -0500 Received: from psplinux063.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s4KAC4h9020027; Tue, 20 May 2014 05:12:05 -0500 From: Sekhar Nori To: David Miller CC: Kevin Hilman , Linux DaVinci Mailing List , Linux netdev Mailing List , Prabhakar Lad , Mugunthan V N , Sekhar Nori Subject: [PATCH] net: davinci_emac: fix oops caused by uninitialized ndev->dev Date: Tue, 20 May 2014 15:41:37 +0530 Message-ID: <1400580697-24994-1-git-send-email-nsekhar@ti.com> X-Mailer: git-send-email 1.7.10.1 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: netdev@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: nsekhar@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Commit e194312854edc22a2faf1931b3c0608fe20cb969 (drivers: net: davinci_cpdma: Convert kzalloc() to devm_kzalloc()) triggered a bug in emac_probe() wherein dev member of net_device is used for devres allocations even before it is initialized. This patch fixes that by using the struct device in platform_device instead. While at it, use &pdev->dev consistently for console messages instead of using ndev->dev for just one case and remove an unnecessary line continuation. Reported-by: Kevin Hilman Helped-by: George Cherian Signed-off-by: Sekhar Nori Acked-by: Mugunthan V N Tested-by: Lad, Prabhakar Tested-by: Kevin Hilman --- This patch fixes a bug in linux-next so it can wait for v3.16 drivers/net/ethernet/ti/davinci_emac.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index e76eae5..f32d730 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c @@ -1865,7 +1865,6 @@ static int davinci_emac_probe(struct platform_device *pdev) struct emac_priv *priv; unsigned long hw_ram_addr; struct emac_platform_data *pdata; - struct device *emac_dev; struct cpdma_params dma_params; struct clk *emac_clk; unsigned long emac_bus_frequency; @@ -1911,7 +1910,6 @@ static int davinci_emac_probe(struct platform_device *pdev) priv->coal_intvl = 0; priv->bus_freq_mhz = (u32)(emac_bus_frequency / 1000000); - emac_dev = &ndev->dev; /* Get EMAC platform data */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->emac_base_phys = res->start + pdata->ctrl_reg_offset; @@ -1930,7 +1928,7 @@ static int davinci_emac_probe(struct platform_device *pdev) hw_ram_addr = (u32 __force)res->start + pdata->ctrl_ram_offset; memset(&dma_params, 0, sizeof(dma_params)); - dma_params.dev = emac_dev; + dma_params.dev = &pdev->dev; dma_params.dmaregs = priv->emac_base; dma_params.rxthresh = priv->emac_base + 0x120; dma_params.rxfree = priv->emac_base + 0x140; @@ -1994,7 +1992,7 @@ static int davinci_emac_probe(struct platform_device *pdev) if (netif_msg_probe(priv)) { - dev_notice(emac_dev, "DaVinci EMAC Probe found device "\ + dev_notice(&pdev->dev, "DaVinci EMAC Probe found device " "(regs: %p, irq: %d)\n", (void *)priv->emac_base_phys, ndev->irq); }