diff --git a/ibsim/ibsim.c b/ibsim/ibsim.c
index 40e605c75429..4e01f55f1817 100644
--- a/ibsim/ibsim.c
+++ b/ibsim/ibsim.c
@@ -664,7 +664,7 @@ Client *find_client(Port * port, int response, int qp, uint64_t trid)
 			return cl;
 	}
 	DEBUG("no client found");
-	return 0;
+	return NULL;
 }
 
 void usage(char *prog_name)
diff --git a/ibsim/sim_cmd.c b/ibsim/sim_cmd.c
index 4345731e5081..92343525645b 100644
--- a/ibsim/sim_cmd.c
+++ b/ibsim/sim_cmd.c
@@ -633,7 +633,7 @@ static Port *find_port(int lid)
 	}
 	if (port && (port->lid + (1 << port->lmc)) > lid)
 		return port;
-	return 0;
+	return NULL;
 }
 
 static int do_change_baselid(FILE * f, char *line)
diff --git a/ibsim/sim_mad.c b/ibsim/sim_mad.c
index 0312c05f2e34..edb23952b47a 100644
--- a/ibsim/sim_mad.c
+++ b/ibsim/sim_mad.c
@@ -1639,7 +1639,7 @@ static Port *lid_route_MAD(Port * port, int lid)
 
 	if (lid == 0) {
 		IBWARN("invalid lid 0");
-		return 0;
+		return NULL;
 	}
 
 	if (is_port_lid(port, lid))
@@ -1649,11 +1649,11 @@ static Port *lid_route_MAD(Port * port, int lid)
 		pc_add_error_xmitdiscards(port);
 		IBWARN("failed: disconnected node 0x%" PRIx64 " or port 0x%"
 		       PRIx64 "?", node->nodeguid, port->portguid);
-		return 0;
+		return NULL;
 	}
 
 	if (!pc_updated(&tport, port))	// if Client connected via HCA ...
-		return 0;
+		return NULL;
 
 	for (hop = 0; !is_port_lid(port, lid) && hop < MAXHOPS; hop++) {
 		portnum = switch_lookup(node, lid);
@@ -1662,7 +1662,7 @@ static Port *lid_route_MAD(Port * port, int lid)
 			pc_add_error_rcvswitchrelay(port);
 			DEBUG("illegal lid %u (outport %d node %s ports %d)",
 			      lid, portnum, node->nodeid, node->numports);
-			return 0;
+			return NULL;
 		}
 
 		DEBUG("node %" PRIx64 " outport %d", node->nodeguid, portnum);
@@ -1676,7 +1676,7 @@ static Port *lid_route_MAD(Port * port, int lid)
 
 		if (!link_valid(port)) {
 			pc_add_error_xmitdiscards(port);
-			return 0;
+			return NULL;
 		}
 
 		tport = port;	// prepare to pass PKT to next port
@@ -1687,7 +1687,7 @@ static Port *lid_route_MAD(Port * port, int lid)
 		if (port_get_remote(port, &node, &port) < 0) {
 			pc_add_error_xmitdiscards(tport);
 			IBWARN("no remote");
-			return 0;
+			return NULL;
 		}
 
 		if (!node || !port)	// double check ?...
@@ -1695,11 +1695,11 @@ static Port *lid_route_MAD(Port * port, int lid)
 
 		if (!link_valid(port)) {
 			pc_add_error_xmitdiscards(tport);
-			return 0;
+			return NULL;
 		}
 
 		if (!pc_updated(&tport, port))	//try to transmit PKT
-			return 0;
+			return NULL;
 	}
 
 	DEBUG("routed to node %s port 0x%" PRIx64 " portnum %d (%p)",
@@ -1818,7 +1818,7 @@ static Smpfn *get_handle_fn(ib_rpc_t rpc, int response)
 	Smpfn *fn;
 
 	if (response)
-		return 0;
+		return NULL;
 
 	fn = get_smp_handler(rpc.mgtclass & 0xf , rpc.attr.id);
 	return fn;
diff --git a/ibsim/sim_net.c b/ibsim/sim_net.c
index 8695815d9a74..a963ff6d6589 100644
--- a/ibsim/sim_net.c
+++ b/ibsim/sim_net.c
@@ -251,7 +251,7 @@ static Switch *new_switch(Node * nd, int set_esp0)
 
 	if (netswitches >= maxnetswitches) {
 		IBPANIC("no more switches (max %d)", maxnetswitches);
-		return 0;
+		return NULL;
 	}
 
 	sw = switches + netswitches++;
@@ -304,22 +304,22 @@ static Node *new_node(int type, char *nodename, char *nodedesc, int nodeports)
 	Node *nd;
 
 	if (build_nodeid(nodeid, sizeof(nodeid), nodename) < 0)
-		return 0;
+		return NULL;
 
 	if (find_node(nodeid)) {
 		IBWARN("node id %s already exists", nodeid);
-		return 0;
+		return NULL;
 	}
 
 	if (netnodes >= maxnetnodes) {
 		IBPANIC("no more nodes (max %d)", maxnetnodes);
-		return 0;
+		return NULL;
 	}
 
 	if (find_node_by_guid(guids[type])) {
 		IBWARN("node %s guid %" PRIx64 " already exists",
 		       node_type_name(type), guids[type]);
-		return 0;
+		return NULL;
 	}
 
 	nd = nodes + netnodes++;
@@ -354,7 +354,7 @@ static Node *new_node(int type, char *nodename, char *nodedesc, int nodeports)
 	if ((nd->portsbase = new_ports(nd, nodeports, firstport)) < 0) {
 		IBWARN("can't alloc %d ports for node %s", nodeports,
 		       nd->nodeid);
-		return 0;
+		return NULL;
 	}
 
 	netvendid = 0;
@@ -376,7 +376,7 @@ static char *parse_node_id(char *buf, char **rest_buf)
 
 	if (!(s = strchr(buf, '"')) || !(e = strchr(s + 1, '"'))) {
 		IBWARN("can't find valid id in <%s>", buf);
-		return 0;
+		return NULL;
 	}
 	*e = 0;
 	if (rest_buf)
@@ -678,7 +678,7 @@ char *map_alias(char *alias)
 		if (aliases[i][len] == '#')
 			return aliases[i] + len + 1;
 	}
-	return 0;
+	return NULL;
 }
 
 char *expand_name(char *base, char *name, char **portstr)
@@ -686,7 +686,7 @@ char *expand_name(char *base, char *name, char **portstr)
 	char *s;
 
 	if (!base)
-		return 0;
+		return NULL;
 
 	if (!strchr(base, '@')) {
 		if (netprefix[0] != 0 && !strchr(base, '#'))
@@ -703,7 +703,7 @@ char *expand_name(char *base, char *name, char **portstr)
 	PDEBUG("alias %s", name);
 
 	if (!(s = map_alias(name)))
-		return 0;
+		return NULL;
 
 	strncpy(name, s, NODEIDLEN - 1);
 
@@ -1481,13 +1481,13 @@ Node *find_node(char *desc)
 	Node *nd, *e;
 
 	if (!desc)
-		return 0;
+		return NULL;
 
 	for (nd = nodes, e = nodes + netnodes; nd < e; nd++)
 		if (!strcmp(desc, nd->nodeid))
 			return nd;
 
-	return 0;
+	return NULL;
 }
 
 Node *find_node_by_desc(char *desc)
@@ -1495,13 +1495,13 @@ Node *find_node_by_desc(char *desc)
 	Node *nd, *e;
 
 	if (!desc)
-		return 0;
+		return NULL;
 
 	for (nd = nodes, e = nodes + netnodes; nd < e; nd++)
 		if (!strcmp(desc, nd->nodedesc))
 			return nd;
 
-	return 0;
+	return NULL;
 }
 
 Node *find_node_by_guid(uint64_t guid)
@@ -1509,13 +1509,13 @@ Node *find_node_by_guid(uint64_t guid)
 	Node *nd, *e;
 
 	if (ignoreduplicate)
-		return 0;
+		return NULL;
 
 	for (nd = nodes, e = nodes + netnodes; nd < e; nd++)
 		if (nd->nodeguid == guid)
 			return nd;
 
-	return 0;
+	return NULL;
 }
 
 Port *node_get_port(Node * node, int portnum)
