mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: <dinguyen@opensource.altera.com>
To: <davem@davemloft.net>, <peppe.cavallaro@st.com>
Cc: <dinh.linux@gmail.com>, <maxime.ripard@free-electrons.com>,
	<olof@lixom.net>, <vbridger@opensource.altera.com>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Dinh Nguyen <dinguyen@opensource.altera.com>
Subject: [PATCH] stmmac: platform: fix stmmac probe failure
Date: Mon, 1 Dec 2014 14:00:54 -0600	[thread overview]
Message-ID: <1417464054-8777-1-git-send-email-dinguyen@opensource.altera.com> (raw)

From: Dinh Nguyen <dinguyen@opensource.altera.com>

The commit 571dcfde23712b ("stmmac: platform: fix default values of the filter
bins setting") broke support for stmmac probe for all CONFIG_OF platforms.

[    0.743567] Unable to handle kernel NULL pointer dereference at virtual address 00000048
[    0.751679] pgd = c0004000
[    0.754384] [00000048] *pgd=00000000
[    0.757983] Internal error: Oops: 805 [#1] SMP ARM
[    0.762774] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.18.0-rc7 #1
[    0.769034] task: ee86c000 ti: ee870000 task.ti: ee870000
[    0.774429] PC is at stmmac_pltfr_probe+0x40/0x5d0
[    0.779217] LR is at devm_ioremap_nocache+0x54/0x74
...
[    0.951644] [<c0287938>] (stmmac_pltfr_probe) from [<c0234c4c>] (platform_drv_probe+0x44/0xa4)
[    0.960250] [<c0234c4c>] (platform_drv_probe) from [<c023390c>] (driver_probe_device+0x10c/0x240)
[    0.969113] [<c023390c>] (driver_probe_device) from [<c0233b10>] (__driver_attach+0x8c/0x90)
[    0.977544] [<c0233b10>] (__driver_attach) from [<c02320fc>] (bus_for_each_dev+0x6c/0xa0)

The reason is that in stmmac_pltfr_probe(), the plat_dat on a CONFIG_OF
platform is NULL until devm_kzalloc() is called to allocate plat_dat.

Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 5b0da39..62c9e75 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -265,12 +265,6 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
 
 	plat_dat = dev_get_platdata(&pdev->dev);
 
-	/* Set default value for multicast hash bins */
-	plat_dat->multicast_filter_bins = HASH_TABLE_SIZE;
-
-	/* Set default value for unicast filter entries */
-	plat_dat->unicast_filter_entries = 1;
-
 	if (pdev->dev.of_node) {
 		if (!plat_dat)
 			plat_dat = devm_kzalloc(&pdev->dev,
@@ -288,6 +282,12 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
 		}
 	}
 
+	/* Set default value for multicast hash bins */
+	plat_dat->multicast_filter_bins = HASH_TABLE_SIZE;
+
+	/* Set default value for unicast filter entries */
+	plat_dat->unicast_filter_entries = 1;
+
 	/* Custom setup (if needed) */
 	if (plat_dat->setup) {
 		plat_dat->bsp_priv = plat_dat->setup(pdev);
-- 
2.0.3


             reply	other threads:[~2014-12-01 20:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-01 20:00 dinguyen [this message]
2014-12-01 20:14 ` Dinh Nguyen

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=1417464054-8777-1-git-send-email-dinguyen@opensource.altera.com \
    --to=dinguyen@opensource.altera.com \
    --cc=davem@davemloft.net \
    --cc=dinh.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.ripard@free-electrons.com \
    --cc=netdev@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=peppe.cavallaro@st.com \
    --cc=vbridger@opensource.altera.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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

all inboxes | Powered by JetHome®