* [PATCH] stmmac: fix kernel crash when device probed for SPEAr with DT
@ 2012-04-17 9:24 Viresh Kumar
2012-04-18 5:11 ` Giuseppe CAVALLARO
0 siblings, 1 reply; 4+ messages in thread
From: Viresh Kumar @ 2012-04-17 9:24 UTC (permalink / raw)
To: peppe.cavallaro; +Cc: spear-devel, viresh.linux, netdev, davem, Viresh Kumar
plat->dma_cfg is never allocated memory and is tried to be filled when we boot
it for SPEAr SoCs with DT. And so get a kernel crash.
Fix it by allocating memory for dma_cfg.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
---
.../net/ethernet/stmicro/stmmac/stmmac_platform.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 12bd221..f124f60 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -110,6 +110,14 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
goto out_unmap;
}
+ plat_dat->dma_cfg = devm_kzalloc(&pdev->dev,
+ sizeof(*plat_dat->dma_cfg), GFP_KERNEL);
+ if (!plat_dat->dma_cfg) {
+ pr_err("%s: ERROR: no memory for dma_cfg", __func__);
+ ret = -ENOMEM;
+ goto out_unmap;
+ }
+
ret = stmmac_probe_config_dt(pdev, plat_dat, &mac);
if (ret) {
pr_err("%s: main dt probe failed", __func__);
--
1.7.9
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] stmmac: fix kernel crash when device probed for SPEAr with DT
2012-04-17 9:24 [PATCH] stmmac: fix kernel crash when device probed for SPEAr with DT Viresh Kumar
@ 2012-04-18 5:11 ` Giuseppe CAVALLARO
2012-04-18 5:14 ` Viresh Kumar
0 siblings, 1 reply; 4+ messages in thread
From: Giuseppe CAVALLARO @ 2012-04-18 5:11 UTC (permalink / raw)
To: Viresh KUMAR; +Cc: spear-devel, viresh.linux, netdev, davem, Deepak SIKRI
Hi Viresh
On 4/17/2012 11:24 AM, Viresh KUMAR wrote:
> plat->dma_cfg is never allocated memory and is tried to be filled when we boot
> it for SPEAr SoCs with DT. And so get a kernel crash.
>
> Fix it by allocating memory for dma_cfg.
The fix seems to be legal but I'd like to do a review of the code again.
I was reluctant to add the dma_cfg because it had a big impact on
several platforms etc (as discussed with SPEAr guys). I accepted it
because logically correct and tidied-up the code, indeed.
I hoped it was fully tested on SPEAr platforms. at any rate, I'll look
at you patch and perform some tests on my boards and then come-back to you.
Kind Regards
Peppe
>
> Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
> ---
> .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 8 ++++++++
> 1 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> index 12bd221..f124f60 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> @@ -110,6 +110,14 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
> goto out_unmap;
> }
>
> + plat_dat->dma_cfg = devm_kzalloc(&pdev->dev,
> + sizeof(*plat_dat->dma_cfg), GFP_KERNEL);
> + if (!plat_dat->dma_cfg) {
> + pr_err("%s: ERROR: no memory for dma_cfg", __func__);
> + ret = -ENOMEM;
> + goto out_unmap;
> + }
> +
> ret = stmmac_probe_config_dt(pdev, plat_dat, &mac);
> if (ret) {
> pr_err("%s: main dt probe failed", __func__);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] stmmac: fix kernel crash when device probed for SPEAr with DT
2012-04-18 5:11 ` Giuseppe CAVALLARO
@ 2012-04-18 5:14 ` Viresh Kumar
2012-04-19 5:51 ` Giuseppe CAVALLARO
0 siblings, 1 reply; 4+ messages in thread
From: Viresh Kumar @ 2012-04-18 5:14 UTC (permalink / raw)
To: Giuseppe CAVALLARO
Cc: spear-devel, viresh.linux@gmail.com, netdev@vger.kernel.org,
davem@davemloft.net, Deepak SIKRI
On 4/18/2012 10:41 AM, Giuseppe CAVALLARO wrote:
> I hoped it was fully tested on SPEAr platforms. at any rate
I am only working for SPEAr3xx with DT support and this patch is must as
without it we have build failures. Haven't tested on any other SPEAr SoCs, they
may require extra pdata fields to be initialized, but that will follow with
their DT support.
--
viresh
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] stmmac: fix kernel crash when device probed for SPEAr with DT
2012-04-18 5:14 ` Viresh Kumar
@ 2012-04-19 5:51 ` Giuseppe CAVALLARO
0 siblings, 0 replies; 4+ messages in thread
From: Giuseppe CAVALLARO @ 2012-04-19 5:51 UTC (permalink / raw)
To: Viresh Kumar
Cc: spear-devel, viresh.linux@gmail.com, netdev@vger.kernel.org,
davem@davemloft.net, Deepak SIKRI
Hello Viresh.
On 4/18/2012 7:14 AM, Viresh Kumar wrote:
> On 4/18/2012 10:41 AM, Giuseppe CAVALLARO wrote:
>> I hoped it was fully tested on SPEAr platforms. at any rate
>
> I am only working for SPEAr3xx with DT support and this patch is must as
> without it we have build failures. Haven't tested on any other SPEAr SoCs, they
> may require extra pdata fields to be initialized, but that will follow with
> their DT support.
>
I've just sent 4 patches so I kindly ask you to review the patch named:
[net-next 3/4] stmmac: verify the dma_cfg platform fields
where I reworked the logic behind the dma_cfg conf.
Peppe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-04-19 5:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-17 9:24 [PATCH] stmmac: fix kernel crash when device probed for SPEAr with DT Viresh Kumar
2012-04-18 5:11 ` Giuseppe CAVALLARO
2012-04-18 5:14 ` Viresh Kumar
2012-04-19 5:51 ` Giuseppe CAVALLARO
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.