summaryrefslogtreecommitdiffstats
path: root/drivers/net/stmmac/dwmac1000_core.c
diff options
context:
space:
mode:
authorDan Carpenter2010-07-22 03:16:48 +0200
committerDavid S. Miller2010-07-22 23:14:48 +0200
commit1ff219068c0e032a6fd64c45bd69f3bc7374feb6 (patch)
tree9978774f6e4f5b1fbcc2e6dd9e178e31f4c1a9e4 /drivers/net/stmmac/dwmac1000_core.c
parentcaif: precedence bug (diff)
downloadkernel-qcow2-linux-1ff219068c0e032a6fd64c45bd69f3bc7374feb6.tar.gz
kernel-qcow2-linux-1ff219068c0e032a6fd64c45bd69f3bc7374feb6.tar.xz
kernel-qcow2-linux-1ff219068c0e032a6fd64c45bd69f3bc7374feb6.zip
stmmac: handle allocation errors in setup functions
If the allocations fail in either dwmac1000_setup() or dwmac100_setup() then return NULL. These are called from stmmac_mac_device_setup(). The check for NULL returns in stmmac_mac_device_setup() needed to be moved forward a couple lines. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/stmmac/dwmac1000_core.c')
-rw-r--r--drivers/net/stmmac/dwmac1000_core.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/stmmac/dwmac1000_core.c b/drivers/net/stmmac/dwmac1000_core.c
index 917b4e16923b..2b2f5c8caf1c 100644
--- a/drivers/net/stmmac/dwmac1000_core.c
+++ b/drivers/net/stmmac/dwmac1000_core.c
@@ -220,6 +220,8 @@ struct mac_device_info *dwmac1000_setup(unsigned long ioaddr)
((uid & 0x0000ff00) >> 8), (uid & 0x000000ff));
mac = kzalloc(sizeof(const struct mac_device_info), GFP_KERNEL);
+ if (!mac)
+ return NULL;
mac->mac = &dwmac1000_ops;
mac->dma = &dwmac1000_dma_ops;