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] ne2000: Fix broken build of three boards after CONFIG_NET_MULTI drop
Date: Mon, 17 Oct 2011 18:29:32 -0400	[thread overview]
Message-ID: <201110171829.33368.vapier@gentoo.org> (raw)
In-Reply-To: <201110171826.38699.vapier@gentoo.org>

On Monday 17 October 2011 18:26:38 Mike Frysinger wrote:
> On Monday 17 October 2011 18:05:28 Bernhard Kaindl wrote:
> > >> +	dev = calloc(sizeof(*dev), 1);
> > >> +	pbuf = malloc(NE2000_RX_BUFFER_SIZE);
> > >> +	if (dev == NULL || pbuf == NULL)
> > >> +		return -1;
> > > 
> > > if dev worked but pbuf failed, this leaks memory
> > 
> > If malloc fails here, either CONFIG_SYS_MALLOC_LEN is to small or malloc
> > is broken. Three Ethernet drivers call hang() in this case, which is
> > probably best in explaining to the developer who broke it.
> > I can replace that with "goto error" and give an error message on it
> > like the other recently merged drivers do in this init situation.
> 
> i know there's inconsistency here with some drivers, but the current "best
> practices" is to not leak and return 0.

meh, for now, keep the -1.  but don't leak.  i'll review the drivers and 
update the documentation.
-mike

  reply	other threads:[~2011-10-17 22:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-16 18:12 [U-Boot] [PATCH] ne2000: Fix broken build of three boards after CONFIG_NET_MULTI drop Bernhard Kaindl
2011-10-16 19:39 ` Mike Frysinger
2011-10-17 22:05   ` Bernhard Kaindl
2011-10-17 22:26     ` Mike Frysinger
2011-10-17 22:29       ` Mike Frysinger [this message]
2011-10-20 20:56         ` [U-Boot] [PATCH v2] ne2000: Convert to new net-multi model, fixes build of three boards Bernhard Kaindl
2011-12-07 21:45           ` Marek Vasut
2011-12-08 21:27           ` Wolfgang Denk
2011-12-09  3:47           ` Mike Frysinger

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=201110171829.33368.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