[U-Boot] [PATCH] cs8900 assign dev->priv before using it

Hui.Tang zetalabs at gmail.com
Thu Oct 29 09:49:27 CET 2009


cs8900_get_enetaddr() call get_reg_init_bus(), which will use dev->priv in CONFIG_CS8900_BUS16 config, so we should assign dev->priv before using it.

---
 drivers/net/cs8900.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/cs8900.c b/drivers/net/cs8900.c
index 587f7f6..962b74c 100644
--- a/drivers/net/cs8900.c
+++ b/drivers/net/cs8900.c
@@ -320,12 +320,12 @@ int cs8900_initialize(u8 dev_num, int base_addr)
 	}
 	memset(priv, 0, sizeof(*priv));
 	priv->regs = (struct cs8900_regs *)base_addr;
+	dev->priv = priv;
 
 	/* Load MAC address from EEPROM */
 	cs8900_get_enetaddr(dev);
 
 	dev->iobase = base_addr;
-	dev->priv = priv;
 	dev->init = cs8900_init;
 	dev->halt = cs8900_halt;
 	dev->send = cs8900_send;
-- 
1.6.0.4



More information about the U-Boot mailing list