summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/samsung
diff options
context:
space:
mode:
authorGirish K.S <ks.giri@samsung.com>2015-01-15 02:41:47 +0100
committerDavid S. Miller <davem@davemloft.net>2015-01-16 01:01:10 +0100
commit1c1832c7cd35db90b126a984685b44858ad63d01 (patch)
tree47a4fcdd7514a9b1b575bbc6da383e1a111aa164 /drivers/net/ethernet/samsung
parentsh_eth: Fix addition of .trscer_err_mask to wrong SoC data (diff)
downloadlinux-1c1832c7cd35db90b126a984685b44858ad63d01.tar.xz
linux-1c1832c7cd35db90b126a984685b44858ad63d01.zip
net: sxgbe: Fix NULL dereferece when using DT
When the MAC address is provided in the device tree file, the condition is true and kernel crashes due to NULL dereference. Signed-off-by: Girish K.S <ks.giri@samsung.com> Signed-off-by: Byungho An <bh74.an@samsung.com> Signed-off-by: Kukjin Kim <kgene@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/samsung')
-rw-r--r--drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
index 866560ea9e18..b02eed12bfc5 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
@@ -108,10 +108,6 @@ static int sxgbe_platform_probe(struct platform_device *pdev)
}
}
- /* Get MAC address if available (DT) */
- if (mac)
- ether_addr_copy(priv->dev->dev_addr, mac);
-
priv = sxgbe_drv_probe(&(pdev->dev), plat_dat, addr);
if (!priv) {
pr_err("%s: main driver probe failed\n", __func__);
@@ -125,6 +121,10 @@ static int sxgbe_platform_probe(struct platform_device *pdev)
goto err_drv_remove;
}
+ /* Get MAC address if available (DT) */
+ if (mac)
+ ether_addr_copy(priv->dev->dev_addr, mac);
+
/* Get the TX/RX IRQ numbers */
for (i = 0, chan = 1; i < SXGBE_TX_QUEUES; i++) {
priv->txq[i]->irq_no = irq_of_parse_and_map(node, chan++);