netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Allan Stephens <allan.stephens@windriver.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, allan.stephens@windriver.com
Subject: [PATCH 3/5 net-next-2.6] [TIPC]: Optimize null pointer check during neighbor discovery
Date: Tue, 20 May 2008 17:08:30 -0400	[thread overview]
Message-ID: <1211317712-13596-4-git-send-email-allan.stephens@windriver.com> (raw)
In-Reply-To: <1211317712-13596-1-git-send-email-allan.stephens@windriver.com>

This patch optimizes TIPC neighbor discovery code to avoid testing for
a null node pointer when the pointer is already known to be non-null.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
---
 net/tipc/discover.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index 5d643e5..faeaf06 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -200,9 +200,8 @@ void tipc_disc_recv_msg(struct sk_buff *buf)
 		dbg(" in own cluster\n");
 		if (n_ptr == NULL) {
 			n_ptr = tipc_node_create(orig);
-		}
-		if (n_ptr == NULL) {
-			return;
+			if (!n_ptr)
+				return;
 		}
 		spin_lock_bh(&n_ptr->lock);
 		link = n_ptr->links[b_ptr->identity];
-- 
1.5.3.2


  parent reply	other threads:[~2008-05-20 21:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-20 21:08 [PATCH 0/5 net-next-2.6] [TIPC]: Fixes to several obscure problems Allan Stephens
2008-05-20 21:08 ` [PATCH 1/5 net-next-2.6] [TIPC]: Fix skb_under_panic when configuring TIPC without privileges Allan Stephens
2008-05-20 21:08 ` [PATCH 2/5 net-next-2.6] [TIPC]: Prevent node object duplication due to simultaneous discovery Allan Stephens
2008-05-20 21:08 ` Allan Stephens [this message]
2008-05-20 21:08 ` [PATCH 4/5 net-next-2.6] [TIPC]: Update "previous node" indicators when node address changes Allan Stephens
2008-05-20 21:08 ` [PATCH 5/5 net-next-2.6] [TIPC]: Fix initialization sequence problems when entering network mode Allan Stephens
2008-05-21 21:55 ` [PATCH 0/5 net-next-2.6] [TIPC]: Fixes to several obscure problems 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=1211317712-13596-4-git-send-email-allan.stephens@windriver.com \
    --to=allan.stephens@windriver.com \
    --cc=davem@davemloft.net \
    --cc=netdev@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).