diff mbox

opensm/osm_ucast_ftree.c: Eliminate unneeded NULL pointer checks prior to calls to free

Message ID 50BCC48F.4070705@dev.mellanox.co.il (mailing list archive)
State Accepted
Delegated to: Alex Netes
Headers show

Commit Message

Hal Rosenstock Dec. 3, 2012, 3:26 p.m. UTC
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
---
 opensm/osm_ucast_ftree.c |   20 ++++++--------------
 1 files changed, 6 insertions(+), 14 deletions(-)

Comments

Alex Netes Jan. 30, 2013, 5:51 p.m. UTC | #1
Hi Hal,

On 10:26 Mon 03 Dec     , Hal Rosenstock wrote:
> 
> Signed-off-by: Hal Rosenstock <hal@mellanox.com>
> ---

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/opensm/osm_ucast_ftree.c b/opensm/osm_ucast_ftree.c
index 133fd4f..d58fff1 100644
--- a/opensm/osm_ucast_ftree.c
+++ b/opensm/osm_ucast_ftree.c
@@ -341,8 +341,6 @@  static ftree_sw_tbl_element_t *sw_tbl_element_create(IN ftree_sw_t * p_sw)
 
 static void sw_tbl_element_destroy(IN ftree_sw_tbl_element_t * p_element)
 {
-	if (!p_element)
-		return;
 	free(p_element);
 }
 
@@ -370,8 +368,7 @@  static ftree_port_t *port_create(IN uint8_t port_num,
 
 static void port_destroy(IN ftree_port_t * p_port)
 {
-	if (p_port)
-		free(p_port);
+	free(p_port);
 }
 
 /***************************************************
@@ -609,12 +606,9 @@  static void sw_destroy(IN ftree_fabric_t * p_ftree, IN ftree_sw_t * p_sw)
 		port_group_destroy(p_sw->sibling_port_groups[i]);
 	for (i = 0; i < p_sw->up_port_groups_num; i++)
 		port_group_destroy(p_sw->up_port_groups[i]);
-	if (p_sw->down_port_groups)
-		free(p_sw->down_port_groups);
-	if (p_sw->sibling_port_groups)
-		free(p_sw->sibling_port_groups);
-	if (p_sw->up_port_groups)
-		free(p_sw->up_port_groups);
+	free(p_sw->down_port_groups);
+	free(p_sw->sibling_port_groups);
+	free(p_sw->up_port_groups);
 
 	free(p_sw);
 }				/* sw_destroy() */
@@ -829,8 +823,7 @@  static void hca_destroy(IN ftree_hca_t * p_hca)
 	for (i = 0; i < p_hca->up_port_groups_num; i++)
 		port_group_destroy(p_hca->up_port_groups[i]);
 
-	if (p_hca->up_port_groups)
-		free(p_hca->up_port_groups);
+	free(p_hca->up_port_groups);
 
 	free(p_hca);
 }
@@ -1702,8 +1695,7 @@  static int fabric_create_leaf_switch_array(IN ftree_fabric_t * p_ftree)
 		p_ftree->leaf_switches_num);
 
 Exit:
-	if (all_switches_at_leaf_level)
-		free(all_switches_at_leaf_level);
+	free(all_switches_at_leaf_level);
 	OSM_LOG_EXIT(&p_ftree->p_osm->log);
 	return res;
 }				/* fabric_create_leaf_switch_array() */