summaryrefslogtreecommitdiff
path: root/cpu
diff options
context:
space:
mode:
authorWolfgang Denk <wd@pollux.denx.de>2006-03-13 01:00:22 +0100
committerWolfgang Denk <wd@pollux.denx.de>2006-03-13 01:00:22 +0100
commit95515306155b8b7fca1a38f192f23ea49251edf8 (patch)
tree51a39a6d4587e91f1d5fae503b2aecfe0445fd89 /cpu
parentc15f80eaefa7ece72272e6f441f0ed36eab14411 (diff)
downloadu-boot-imx-95515306155b8b7fca1a38f192f23ea49251edf8.zip
u-boot-imx-95515306155b8b7fca1a38f192f23ea49251edf8.tar.gz
u-boot-imx-95515306155b8b7fca1a38f192f23ea49251edf8.tar.bz2
au1x00_eth.c: check malloc return value and abort if it failed
Patch by Andrew Dyer, 26 Jul 2005
Diffstat (limited to 'cpu')
-rw-r--r--cpu/mips/au1x00_eth.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/cpu/mips/au1x00_eth.c b/cpu/mips/au1x00_eth.c
index 9ce9b35..078e832 100644
--- a/cpu/mips/au1x00_eth.c
+++ b/cpu/mips/au1x00_eth.c
@@ -224,10 +224,14 @@ static void au1x00_halt(struct eth_device* dev){
int au1x00_enet_initialize(bd_t *bis){
struct eth_device* dev;
- dev = (struct eth_device*) malloc(sizeof *dev);
+ if ((dev = (struct eth_device*)malloc(sizeof *dev)) == NULL) {
+ puts ("malloc failed\n");
+ return 0;
+ }
+
memset(dev, 0, sizeof *dev);
- sprintf(dev->name, "Au1X00 ETHERNET");
+ sprintf(dev->name, "Au1X00 ethernet");
dev->iobase = 0;
dev->priv = 0;
dev->init = au1x00_init;