提交 4b29bdb0 编写于 作者: K Kumar Gala 提交者: Wolfgang Denk

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: NKumar Gala <galak@kernel.crashing.org>

Fixed typo.
Signed-off-by: NWolfgang Denk <wd@denx.de>
上级 fe7f1883
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册