All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] net: add altera triple speeds ethernet mac driver
Date: Wed, 24 Mar 2010 03:51:50 -0400	[thread overview]
Message-ID: <201003240351.51649.vapier@gentoo.org> (raw)
In-Reply-To: <1269412366-9206-1-git-send-email-thomas@wytron.com.tw>

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100324/650128c6/attachment.pgp 

  reply	other threads:[~2010-03-24  7:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-24  6:32 [U-Boot] [PATCH] net: add altera triple speeds ethernet mac driver Thomas Chou
2010-03-24  7:51 ` Mike Frysinger [this message]
2010-03-25  9:48 ` [U-Boot] [PATCH v2] " Thomas Chou
2010-03-25 10:02 ` [U-Boot] [PATCH v3] " Thomas Chou
2010-03-28  8:32 ` [U-Boot] [PATCH v4 tabify] " Thomas Chou
2010-04-02  1:43   ` Thomas Chou
2010-04-02  3:57     ` Ben Warren
2010-04-05  6:19   ` Ben Warren
2010-04-07  4:01     ` Thomas Chou
2010-04-07 17:30       ` Ben Warren
2010-04-20  4:49 ` [U-Boot] [PATCH v5] " Thomas Chou
2010-04-26  6:13   ` Ben Warren
2010-04-26 14:23     ` Thomas Chou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201003240351.51649.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.