summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuhiro Iwamatsu <iwamatsu@nigauri.org>2010-10-19 14:03:46 +0900
committerWolfgang Denk <wd@denx.de>2010-11-14 23:17:46 +0100
commit7faeb9976a455adbfad30c4b84d3e7b6c22a8fda (patch)
treeaa5e7a736d99ed740839440dd4eb78ca1d41ae49
parent5ed0eeca388de64e3a7f2c1f0e5668704dab71c5 (diff)
downloadu-boot-imx-7faeb9976a455adbfad30c4b84d3e7b6c22a8fda.zip
u-boot-imx-7faeb9976a455adbfad30c4b84d3e7b6c22a8fda.tar.gz
u-boot-imx-7faeb9976a455adbfad30c4b84d3e7b6c22a8fda.tar.bz2
net: tsi108_eth: Add initialized eth_device structure
tsi108_eth driver does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized. Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> CC: Ben Warren <biggerbadderben@gmail.com>
-rw-r--r--drivers/net/tsi108_eth.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c
index 079354a..f100ec1 100644
--- a/drivers/net/tsi108_eth.c
+++ b/drivers/net/tsi108_eth.c
@@ -731,7 +731,11 @@ int tsi108_eth_initialize (bd_t * bis)
for (index = 0; index < CONFIG_TSI108_ETH_NUM_PORTS; index++) {
dev = (struct eth_device *)malloc(sizeof(struct eth_device));
-
+ if (!dev) {
+ printf("tsi108: Can not allocate memory\n");
+ break;
+ }
+ memset(dev, 0, sizeof(*dev));
sprintf (dev->name, "TSI108_eth%d", index);
dev->iobase = ETH_BASE + (index * ETH_PORT_OFFSET);