Netdev List
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Antonio Quartulli <antonio@meshcoding.com>
Cc: Joe Perches <joe@perches.com>,
	Himangi Saraogi <himangi774@gmail.com>,
	Marek Lindner <mareklindner@neomailbox.ch>,
	Simon Wunderlich <sw@simonwunderlich.de>,
	"David S. Miller" <davem@davemloft.net>,
	b.a.t.m.a.n@lists.open-mesh.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, julia.lawall@lip6.fr
Subject: Re: [PATCH] batman-adv: Use kasprintf
Date: Sat, 28 Jun 2014 22:14:03 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.02.1406282212540.2022@localhost6.localdomain6> (raw)
In-Reply-To: <53AF1C42.6000108@meshcoding.com>

On Sat, 28 Jun 2014, Antonio Quartulli wrote:

> Hi all,
> 
> On 28/06/14 21:13, Joe Perches wrote:
> > diff --git a/net/batman-adv/sysfs.c b/net/batman-adv/sysfs.c
> > index f40cb04..d6fba94 100644
> > --- a/net/batman-adv/sysfs.c
> > +++ b/net/batman-adv/sysfs.c
> > @@ -896,7 +896,7 @@ int batadv_throw_uevent(struct batadv_priv *bat_priv, enum batadv_uev_type type,
> >  {
> >  	int ret = -ENOMEM;
> >  	struct kobject *bat_kobj;
> > -	char *uevent_env[4] = { NULL, NULL, NULL, NULL };
> > +	char *uevent_env[3];
> 
> 
> Joe, why are you shortening this? kobject_uevent_env() expect a
> NULL-terminating array (that is the forth cell).
> 
> ...
> 
> >  
> >  	ret = kobject_uevent_env(bat_kobj, KOBJ_CHANGE, uevent_env);
> 
> And how is this change reducing the code space?
> 
> For what concerns the labels, we use this pattern mostly all over the
> code: one single label/exit-point with the related NULL checks. Do you
> think that we can improve something by changing this? (I am not talking
> about the fastpath here).

Most of the kernel uses specific labels for each possible failure.
>From my selfish point of view, it makes the code easier to analyze and 
understand, because what is done at the exit label is only what needs to 
be done.

julia

  parent reply	other threads:[~2014-06-28 20:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-28 18:36 [PATCH] batman-adv: Use kasprintf Himangi Saraogi
2014-06-28 19:13 ` Joe Perches
2014-06-28 19:49   ` Antonio Quartulli
2014-06-28 20:11     ` Joe Perches
2014-06-28 20:14     ` Julia Lawall [this message]
2014-07-08  0:00 ` David Miller

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=alpine.DEB.2.02.1406282212540.2022@localhost6.localdomain6 \
    --to=julia.lawall@lip6.fr \
    --cc=antonio@meshcoding.com \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=davem@davemloft.net \
    --cc=himangi774@gmail.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mareklindner@neomailbox.ch \
    --cc=netdev@vger.kernel.org \
    --cc=sw@simonwunderlich.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