Patchwork [net-next,15/20] tipc: remove pointless check for NULL prior to kfree

login
register
mail settings
Submitter Paul Gortmaker
Date Jan. 1, 2011, 4:59 a.m.
Message ID <1293857975-30267-16-git-send-email-paul.gortmaker@windriver.com>
Download mbox | patch
Permalink /patch/77127/
State Accepted
Delegated to: David Miller
Headers show

Comments

Paul Gortmaker - Jan. 1, 2011, 4:59 a.m.
From: Allan Stephens <Allan.Stephens@windriver.com>

It is acceptable to call kfree() with NULL, so these checks are not
serving any useful purpose.

Signed-off-by: Allan Stephens <Allan.Stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 net/tipc/name_distr.c |    4 +---
 net/tipc/port.c       |    4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

Patch

diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index 376a30b..a6c989f 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -240,9 +240,7 @@  static void node_is_down(struct publication *publ)
 		    publ->type, publ->lower, publ->node, publ->ref, publ->key);
 	}
 
-	if (p) {
-		kfree(p);
-	}
+	kfree(p);
 }
 
 /**
diff --git a/net/tipc/port.c b/net/tipc/port.c
index 8bacd57..db14b7e 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -269,9 +269,7 @@  int tipc_deleteport(u32 ref)
 		buf = port_build_peer_abort_msg(p_ptr, TIPC_ERR_NO_PORT);
 		tipc_nodesub_unsubscribe(&p_ptr->subscription);
 	}
-	if (p_ptr->user_port) {
-		kfree(p_ptr->user_port);
-	}
+	kfree(p_ptr->user_port);
 
 	spin_lock_bh(&tipc_port_list_lock);
 	list_del(&p_ptr->port_list);