summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2010-11-12 04:13:06 -0600
committerWolfgang Denk <wd@denx.de>2010-11-14 23:24:37 +0100
commit4b29bdb0ed08412d225a8be94f61fc6c37a59dd5 (patch)
treef176d3493045da0dd537420c934b1626339f34e2 /drivers/net
parentfe7f1883b704452224af9e8db002a4261a26540d (diff)
downloadu-boot-imx-4b29bdb0ed08412d225a8be94f61fc6c37a59dd5.zip
u-boot-imx-4b29bdb0ed08412d225a8be94f61fc6c37a59dd5.tar.gz
u-boot-imx-4b29bdb0ed08412d225a8be94f61fc6c37a59dd5.tar.bz2
net: e1000: Add initialized eth_device & e1000_hw structure
nic and hw structures are allocated via malloc i.e. return memory is not zero initialized. Because of this few structure member like "function pointers" are initialized with garbage values. It may cause problem. for eg. during eth_initialize, dev->write_hwaddr is used. Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Fixed typo. Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/e1000.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
index 2825342..18584ef 100644
--- a/drivers/net/e1000.c
+++ b/drivers/net/e1000.c
@@ -5177,7 +5177,21 @@ e1000_initialize(bd_t * bis)
}
nic = (struct eth_device *) malloc(sizeof (*nic));
+ if (!nic) {
+ printf("Error: e1000 - Can not alloc memory\n");
+ return 0;
+ }
+
hw = (struct e1000_hw *) malloc(sizeof (*hw));
+ if (!hw) {
+ free(nic);
+ printf("Error: e1000 - Can not alloc memory\n");
+ return 0;
+ }
+
+ memset(nic, 0, sizeof(*dev));
+ memset(hw, 0, sizeof(*hw));
+
hw->pdev = devno;
nic->priv = hw;