Hi,
I am new to the list, any info. Or help is appreciated! I went through C code of Ethernet initialization of U-boot(version u-boot-2010_09.tar.gz ) in the board of db64360 under the board name Marvell and found that there maybe is an obvious coding error in the function void mv64360_eth_initialize(bd_t *bis) located in mv_eth.c. The line is underscored. The line should be: port_private = calloc (sizeof (struct mv64360_eth_priv), 1), because it make next line pointless: ethernet_private->port_private = (void *)port_private; ethernet_private->port_private should point to mv64360_eth_priv, but actually point to (*ethernet_private)ETH_PORT_INFO in the code. Thanks Tim Liu Code snippet from mv64360_eth_initialize: ethernet_private = calloc (sizeof (*ethernet_private), 1); dev->priv = (void *) ethernet_private; if (!ethernet_private) { printf ("%s: %s allocation failure, %s\n", __FUNCTION__, dev->name, "Private Device Structure"); free (dev); return; } /* start with an zeroed ETH_PORT_INFO */ memset (ethernet_private, 0, sizeof (ETH_PORT_INFO)); memcpy (ethernet_private->port_mac_addr, dev->enetaddr, 6); /* set pointer to memory for stats data structure etc... */ port_private = calloc (sizeof (*ethernet_private), 1); //should be sizeof (struct mv64360_eth_priv) ethernet_private->port_private = (void *)port_private; if (!port_private) { printf ("%s: %s allocation failure, %s\n", __FUNCTION__, dev->name, "Port Private Device Structure"); free (ethernet_private); free (dev); return; } port_private->stats = calloc (sizeof (struct net_device_stats), 1); if (!port_private->stats) { printf ("%s: %s allocation failure, %s\n", __FUNCTION__, dev->name, "Net stat Structure"); free (port_private); free (ethernet_private); free (dev); return; } memset (ethernet_private->port_private, 0, sizeof (struct mv64360_eth_priv));
_______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot