* [PATCH] net: davinci_emac: fix oops caused by uninitialized ndev->dev
@ 2014-05-20 10:11 Sekhar Nori
2014-05-20 10:14 ` Mugunthan V N
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Sekhar Nori @ 2014-05-20 10:11 UTC (permalink / raw)
To: David Miller
Cc: Kevin Hilman, Linux DaVinci Mailing List,
Linux netdev Mailing List, Prabhakar Lad, Mugunthan V N,
Sekhar Nori
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 <khilman@linaro.org>
Helped-by: George Cherian <george.cherian@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
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);
}
--
1.7.10.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] net: davinci_emac: fix oops caused by uninitialized ndev->dev
2014-05-20 10:11 [PATCH] net: davinci_emac: fix oops caused by uninitialized ndev->dev Sekhar Nori
@ 2014-05-20 10:14 ` Mugunthan V N
2014-05-20 16:46 ` Prabhakar Lad
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Mugunthan V N @ 2014-05-20 10:14 UTC (permalink / raw)
To: Sekhar Nori, David Miller
Cc: Kevin Hilman, Linux DaVinci Mailing List,
Linux netdev Mailing List, Prabhakar Lad
On Tuesday 20 May 2014 03:41 PM, Sekhar Nori wrote:
> 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 <khilman@linaro.org>
> Helped-by: George Cherian <george.cherian@ti.com>
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> ---
Acked-by: Mugunthan V N <mugunthanvnm@ti.com>
Regards
Mugunthan V N
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: davinci_emac: fix oops caused by uninitialized ndev->dev
2014-05-20 10:11 [PATCH] net: davinci_emac: fix oops caused by uninitialized ndev->dev Sekhar Nori
2014-05-20 10:14 ` Mugunthan V N
@ 2014-05-20 16:46 ` Prabhakar Lad
2014-05-21 23:39 ` Kevin Hilman
2014-05-22 19:22 ` David Miller
3 siblings, 0 replies; 5+ messages in thread
From: Prabhakar Lad @ 2014-05-20 16:46 UTC (permalink / raw)
To: Sekhar Nori
Cc: David Miller, Kevin Hilman, Linux DaVinci Mailing List,
Linux netdev Mailing List, Mugunthan V N
On Tue, May 20, 2014 at 3:41 PM, Sekhar Nori <nsekhar@ti.com> wrote:
> 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 <khilman@linaro.org>
> Helped-by: George Cherian <george.cherian@ti.com>
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Tested-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Regards,
--Prabhakar Lad
> ---
> 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);
> }
> --
> 1.7.10.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: davinci_emac: fix oops caused by uninitialized ndev->dev
2014-05-20 10:11 [PATCH] net: davinci_emac: fix oops caused by uninitialized ndev->dev Sekhar Nori
2014-05-20 10:14 ` Mugunthan V N
2014-05-20 16:46 ` Prabhakar Lad
@ 2014-05-21 23:39 ` Kevin Hilman
2014-05-22 19:22 ` David Miller
3 siblings, 0 replies; 5+ messages in thread
From: Kevin Hilman @ 2014-05-21 23:39 UTC (permalink / raw)
To: Sekhar Nori
Cc: David Miller, Linux DaVinci Mailing List,
Linux netdev Mailing List, Prabhakar Lad, Mugunthan V N
Sekhar Nori <nsekhar@ti.com> writes:
> 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 <khilman@linaro.org>
> Helped-by: George Cherian <george.cherian@ti.com>
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Tested-by: Kevin Hilman <khilman@linaro.org>
I verified this patch fixes the boot on dm365-evm (legacy boot) and
da850-evm (DT boot).
Thanks,
Kevin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: davinci_emac: fix oops caused by uninitialized ndev->dev
2014-05-20 10:11 [PATCH] net: davinci_emac: fix oops caused by uninitialized ndev->dev Sekhar Nori
` (2 preceding siblings ...)
2014-05-21 23:39 ` Kevin Hilman
@ 2014-05-22 19:22 ` David Miller
3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2014-05-22 19:22 UTC (permalink / raw)
To: nsekhar
Cc: khilman, davinci-linux-open-source, netdev, prabhakar.csengg,
mugunthanvnm
From: Sekhar Nori <nsekhar@ti.com>
Date: Tue, 20 May 2014 15:41:37 +0530
> 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 <khilman@linaro.org>
> Helped-by: George Cherian <george.cherian@ti.com>
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> ---
> This patch fixes a bug in linux-next so it can wait for
> v3.16
Applied to net-next, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-05-22 19:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-20 10:11 [PATCH] net: davinci_emac: fix oops caused by uninitialized ndev->dev Sekhar Nori
2014-05-20 10:14 ` Mugunthan V N
2014-05-20 16:46 ` Prabhakar Lad
2014-05-21 23:39 ` Kevin Hilman
2014-05-22 19:22 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).