public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: "Linus Lüssing" <linus.luessing@c0d3.blue>
To: The list for a Better Approach To Mobile Ad-hoc Networking
	<b.a.t.m.a.n@lists.open-mesh.org>
Subject: Re: [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Simple (re)broadcast avoidance
Date: Mon, 1 Aug 2016 22:49:31 +0200	[thread overview]
Message-ID: <20160801204931.GA9200@otheros> (raw)
In-Reply-To: <2274431.CFHQGBLaok@sven-edge>

On Fri, Jul 22, 2016 at 03:12:57PM +0200, Sven Eckelmann wrote:
> > @@ -517,7 +518,8 @@ batadv_neigh_node_get(const struct batadv_orig_node *orig_node,
> >   */
> >  static struct batadv_hardif_neigh_node *
> >  batadv_hardif_neigh_create(struct batadv_hard_iface *hard_iface,
> > -			   const u8 *neigh_addr)
> > +			   const u8 *neigh_addr,
> > +			   struct batadv_orig_node *orig_node)
> >  {
> >  	struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
> >  	struct batadv_hardif_neigh_node *hardif_neigh = NULL;
> > @@ -534,10 +536,12 @@ batadv_hardif_neigh_create(struct batadv_hard_iface *hard_iface,
> >  		goto out;
> >  
> >  	kref_get(&hard_iface->refcount);
> > +	kref_get(&orig_node->refcount);
> >  	INIT_HLIST_NODE(&hardif_neigh->list);
> >  	ether_addr_copy(hardif_neigh->addr, neigh_addr);
> >  	hardif_neigh->if_incoming = hard_iface;
> >  	hardif_neigh->last_seen = jiffies;
> > +	hardif_neigh->orig_node = orig_node;
> 
> Can you please move the kref_get near the place where new reference is used?

Added this suggestion too, although it seems that there is quite
a mixed style at the moment. Most of these allocation functions seem to first
increase refcounts in one block and then do the assignment parts afterwards.

There are a few exceptions though which follow the style you are
suggesting :). (which might be easier to spot refcounting bugs and
therefore nicer, indeed - although the other style might be more
esthetically pleasing as it visually has better alignment prefix
wise, but not sure how much that matters :) )

  reply	other threads:[~2016-08-01 20:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-22 11:38 [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Remove unused skb_reset_mac_header() Linus Lüssing
2016-07-22 11:38 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Simple (re)broadcast avoidance Linus Lüssing
2016-07-22 13:12   ` Sven Eckelmann
2016-08-01 20:49     ` Linus Lüssing [this message]
2016-07-22 13:17 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Remove unused skb_reset_mac_header() Sven Eckelmann

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=20160801204931.GA9200@otheros \
    --to=linus.luessing@c0d3.blue \
    --cc=b.a.t.m.a.n@lists.open-mesh.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