public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] smc911x driver: cleanup smc911x_initialize()
Date: Thu, 21 Jan 2010 18:01:47 -0500	[thread overview]
Message-ID: <201001211801.48290.vapier@gentoo.org> (raw)
In-Reply-To: <20100121212924.GC16182@darwin>

On Thursday 21 January 2010 16:29:24 Matthias Kaehlcke wrote:
> smc911x_initialize(): remove unecessary call to free() and
> return 0 in case of failure instead of -1
> 
> Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
> ---
>  drivers/net/smc911x.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
> index 5d51406..f2b5895 100644
> --- a/drivers/net/smc911x.c
> +++ b/drivers/net/smc911x.c
> @@ -242,8 +242,7 @@ int smc911x_initialize(u8 dev_num, int base_addr)
> 
>  	dev = malloc(sizeof(*dev));
>  	if (!dev) {
> -		free(dev);

OK

> -		return -1;
> +		return 0;

this is an error path, so i think -1 is correct.  if you're out of memory, 
increase your malloc region.
-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/20100121/1b4583b7/attachment.pgp 

  reply	other threads:[~2010-01-21 23:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-21 21:29 [U-Boot] [PATCH] smc911x driver: cleanup smc911x_initialize() Matthias Kaehlcke
2010-01-21 23:01 ` Mike Frysinger [this message]
2010-01-22  6:18   ` Matthias Kaehlcke
2010-01-22  7:36     ` Ben Warren
2010-01-22  9:02       ` Matthias Kaehlcke

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=201001211801.48290.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox