From: Matthias Kaehlcke <matthias@kaehlcke.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] cs8900 driver: cleanup cs8900_initialize()
Date: Thu, 21 Jan 2010 22:12:45 +0100 [thread overview]
Message-ID: <20100121211245.GA16182@darwin> (raw)
In-Reply-To: <4B58C2D5.7090206@gmail.com>
El Thu, Jan 21, 2010 at 01:10:45PM -0800 Ben Warren ha dit:
> Matthias Kaehlcke wrote:
>> cs8900_initialize(): remove unecessary calls to free(), fix memory leak and
>> report errors in the return value
>>
>> Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
>> ---
>> drivers/net/cs8900.c | 7 +++----
>> 1 files changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/net/cs8900.c b/drivers/net/cs8900.c
>> index df36004..7895048 100644
>> --- a/drivers/net/cs8900.c
>> +++ b/drivers/net/cs8900.c
>> @@ -308,15 +308,14 @@ int cs8900_initialize(u8 dev_num, int base_addr)
>> dev = malloc(sizeof(*dev));
>> if (!dev) {
>> - free(dev);
>> - return 0;
>> + return -1;
>>
> 'return 0' is actually correct. It refers to the number of devices that
> were initialized.
ok, i was in doubt and had a look at another driver, which returns a
negative value and followed the bad example :(
> Removing the 'free' calls is good, though.
i'll send out a patch without the return value 'fix' then
best regards
--
Matthias Kaehlcke
Embedded Linux Developer
Barcelona
Si deseas mantener tu libertad, debes estar preparado para defenderla
(Richard Stallman)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
next prev parent reply other threads:[~2010-01-21 21:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-21 20:56 [U-Boot] [PATCH] cs8900 driver: cleanup cs8900_initialize() Matthias Kaehlcke
2010-01-21 21:10 ` Ben Warren
2010-01-21 21:12 ` Matthias Kaehlcke [this message]
2010-01-21 22:02 ` Wolfgang Denk
2010-01-21 22:01 ` 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=20100121211245.GA16182@darwin \
--to=matthias@kaehlcke.net \
--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.