linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa@the-dreams.de>
To: Jean Delvare <jdelvare@suse.de>
Cc: linux-i2c@vger.kernel.org, linux-sh@vger.kernel.org
Subject: Re: [PATCH 2/2] i2c-tools: i2ctransfer: clean up allocated resources
Date: Sun, 14 Feb 2016 20:20:58 +0100	[thread overview]
Message-ID: <20160214192057.GB1522@katana> (raw)
In-Reply-To: <20150911111218.319b0c23@endymion.delvare>

[-- Attachment #1: Type: text/plain, Size: 632 bytes --]


> > +	for (i = 0; i < I2C_RDRW_IOCTL_MAX_MSGS; i++)
> > +		msgs[i].buf = NULL;
> > +
> 
> If you explicitly set "buf = NULL" for zero-length messages in the
> state machine as recommended in my review of the previous patch, this
> is no longer needed.

It is as stated in my previous mail.

We should really play safe here. If we optimize too much, the cleanup
loops become fragile (I tried some options) and one easily misses a
case. Cleaning up is hard, we know that from Linux drivers.

(For me, this is still a good example how letting the OS free memory can
actually prevent bugs. But I give in already ;))


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

      reply	other threads:[~2016-02-14 19:20 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-19 10:40 [PATCH 0/2] new tool 'i2ctransfer' Wolfram Sang
2015-06-19 10:40 ` [PATCH 1/2] i2c-tools: add " Wolfram Sang
     [not found]   ` <1434710432-4182-2-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2015-09-11  8:42     ` Jean Delvare
2016-02-14 19:08       ` Wolfram Sang
2016-04-27 17:33   ` Uwe Kleine-König
2016-04-27 17:37     ` Wolfram Sang
2016-06-19 19:56     ` Uwe Kleine-König
2016-06-19 20:00       ` Wolfram Sang
2016-06-19 21:51         ` Uwe Kleine-König
2016-06-20  6:08           ` Wolfram Sang
2016-06-20  6:49             ` Uwe Kleine-König
2016-06-21  9:12       ` Jean Delvare
2016-06-22 16:52         ` Jean Delvare
2016-06-22 20:40           ` Guenter Roeck
2016-06-22 22:18           ` Wolfram Sang
2016-06-23  7:32           ` New location for i2c-tools.git Uwe Kleine-König
2016-06-23  7:57             ` Angelo Compagnucci
2016-06-23  9:53               ` Jean Delvare
2016-06-23 10:36                 ` Angelo Compagnucci
2016-06-23 17:40                   ` Jean Delvare
2016-06-23 18:50                     ` Wolfram Sang
2016-07-04  8:31                       ` Jean Delvare
2016-07-04 14:38                         ` Wolfram Sang
2015-06-19 10:40 ` [PATCH 2/2] i2c-tools: i2ctransfer: clean up allocated resources Wolfram Sang
2015-09-11  9:12   ` Jean Delvare
2016-02-14 19:20     ` Wolfram Sang [this message]

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=20160214192057.GB1522@katana \
    --to=wsa@the-dreams.de \
    --cc=jdelvare@suse.de \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).