public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Giuseppe CAVALLARO <peppe.cavallaro@st•com>
To: Viresh KUMAR <viresh.kumar@st•com>
Cc: spear-devel@list•st.com, viresh.linux@gmail•com,
	netdev@vger•kernel.org, davem@davemloft•net,
	Deepak SIKRI <deepak.sikri@st•com>
Subject: Re: [PATCH] stmmac: fix kernel crash when device probed for SPEAr with DT
Date: Wed, 18 Apr 2012 07:11:08 +0200	[thread overview]
Message-ID: <4F8E4CEC.9050002@st.com> (raw)
In-Reply-To: <91ea900ce78bb2054d83e0575c16ac70f3f11511.1334654597.git.viresh.kumar@st.com>

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__);

  reply	other threads:[~2012-04-18  5:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2012-04-18  5:14   ` Viresh Kumar
2012-04-19  5:51     ` Giuseppe CAVALLARO

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F8E4CEC.9050002@st.com \
    --to=peppe.cavallaro@st$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=deepak.sikri@st$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=spear-devel@list$(echo .)st.com \
    --cc=viresh.kumar@st$(echo .)com \
    --cc=viresh.linux@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox