On Wednesday 24 March 2010 02:32:46 Thomas Chou wrote: > +int altera_tse_init(bd_t *bis, int num_tses)
so "num_tses" is the # of devices to allocate ...
> + return 1;
... but you always return 1. this should probably be num_tses.
> + for (num = 0; num < num_tses; num++) {
> + dev = (struct eth_device *)malloc(sizeof *dev);
> +
> + if (NULL == dev)
> + return 0;
> +
> + memset(dev, 0, sizeof *dev);
> +
> + priv = (struct altera_tse_priv *)malloc(sizeof(*priv));
malloc returns (void *), so i dont think you need the casts
> + if (NULL == priv)
> + return 0;
this leaks the memory given to dev when there's an error
> + if (NULL == rx_desc || NULL == tx_desc)
> + return 0;
an error here should probably free the current dev/priv structures
> + /* Tell u-boot to get the addr from the env */
> + for (i = 0; i < 6; i++)
> + dev->enetaddr[i] = 0;
you called memset() on *dev already, so this explicit enetaddr init is not
needed
> --- /dev/null
> +++ b/include/altera_tse.h
this should probably live alongside the driver rather than in include/
-mike
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ U-Boot mailing list [email protected] http://lists.denx.de/mailman/listinfo/u-boot

