[PATCH ibdiags 11/16] ibdiags: Use NULL instead of 0 in all places where it used as a pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jason Gunthorpe <jgg@xxxxxxxxxxxx>

Standard coding style. Found by sparse.

Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
---
 libibmad/src/bm.c             |  2 +-
 libibmad/src/fields.c         |  2 +-
 libibmad/src/mad.c            |  6 +++---
 libibmad/src/register.c       |  2 +-
 libibmad/src/resolve.c        |  6 +++---
 libibmad/src/rpc.c            |  4 ++--
 libibmad/src/sa.c             |  2 +-
 libibmad/src/serv.c           |  4 ++--
 libibmad/src/vendor.c         |  4 ++--
 libibnetdisc/src/chassis.c    |  6 +++---
 libibnetdisc/src/query_smp.c  |  4 ++--
 libibnetdisc/test/testleaks.c | 30 +++++++++++++-------------
 src/dump_fts.c                |  6 +++---
 src/ibaddr.c                  |  4 ++--
 src/ibcacheedit.c             | 12 +++++------
 src/ibccconfig.c              |  6 +++---
 src/ibccquery.c               |  8 +++----
 src/ibdiag_common.c           | 14 ++++++------
 src/iblinkinfo.c              |  4 ++--
 src/ibnetdiscover.c           |  4 ++--
 src/ibping.c                  | 14 ++++++------
 src/ibportstate.c             |  6 +++---
 src/ibqueryerrors.c           |  4 ++--
 src/ibroute.c                 | 12 +++++------
 src/ibstat.c                  |  4 ++--
 src/ibsysstat.c               | 12 +++++------
 src/ibtracert.c               | 18 ++++++++--------
 src/perfquery.c               | 14 ++++++------
 src/saquery.c                 |  6 +++---
 src/sminfo.c                  | 10 ++++-----
 src/smpdump.c                 | 12 +++++------
 src/smpquery.c                | 40 +++++++++++++++++------------------
 src/vendstat.c                |  6 +++---
 33 files changed, 144 insertions(+), 144 deletions(-)

diff --git a/libibmad/src/bm.c b/libibmad/src/bm.c
index 318145120efc61..8b3d342284ce00 100644
--- a/libibmad/src/bm.c
+++ b/libibmad/src/bm.c
@@ -98,7 +98,7 @@ uint8_t *bm_call_via(void *data, ib_portid_t * portid, ib_bm_call_t * call,
 		return NULL;
 	}
 
-	if (mad_send_via(&rpc, portid, 0, &bm_data, srcport) < 0)
+	if (mad_send_via(&rpc, portid, NULL, &bm_data, srcport) < 0)
 		return NULL;
 
 return_ok:
diff --git a/libibmad/src/fields.c b/libibmad/src/fields.c
index 1af7a6cfa17880..45eafd94921060 100644
--- a/libibmad/src/fields.c
+++ b/libibmad/src/fields.c
@@ -1256,7 +1256,7 @@ char *mad_dump_field(enum MAD_FIELDS field, char *buf, int bufsz, void *val)
 {
 	if (field <= IB_NO_FIELD || field >= IB_FIELD_LAST_)
 		return NULL;
-	return _mad_dump_field(ib_mad_f + field, 0, buf, bufsz, val);
+	return _mad_dump_field(ib_mad_f + field, NULL, buf, bufsz, val);
 }
 
 char *mad_dump_val(enum MAD_FIELDS field, char *buf, int bufsz, void *val)
diff --git a/libibmad/src/mad.c b/libibmad/src/mad.c
index 5deefa242527b7..2ca317efc9296d 100644
--- a/libibmad/src/mad.c
+++ b/libibmad/src/mad.c
@@ -64,7 +64,7 @@ uint64_t mad_trid(void)
 	uint64_t next;
 
 	if (!trid) {
-		srandom((int)time(0) * getpid());
+		srandom((int)time(NULL) * getpid());
 		trid = random();
 	}
 	next = ++trid;
@@ -189,11 +189,11 @@ int mad_build_pkt(void *umad, ib_rpc_t * rpc, ib_portid_t * dport,
 		addr.flow_label = 0;
 		umad_set_grh(umad, &addr);
 	} else
-		umad_set_grh(umad, 0);
+		umad_set_grh(umad, NULL);
 	umad_set_pkey(umad, is_smi ? 0 : dport->pkey_idx);
 
 	mad = umad_get_mad(umad);
-	p = mad_encode(mad, rpc, lid_routed ? 0 : &dport->drpath, data);
+	p = mad_encode(mad, rpc, lid_routed ? NULL : &dport->drpath, data);
 	if (!p)
 		return -1;
 
diff --git a/libibmad/src/register.c b/libibmad/src/register.c
index 1fdb64a7bd9ef9..d046264bdc69a9 100644
--- a/libibmad/src/register.c
+++ b/libibmad/src/register.c
@@ -91,7 +91,7 @@ int mad_register_port_client(int port_id, int mgmt, uint8_t rmpp_version)
 		return -1;
 	}
 
-	agent = umad_register(port_id, mgmt, vers, rmpp_version, 0);
+	agent = umad_register(port_id, mgmt, vers, rmpp_version, NULL);
 	if (agent < 0)
 		DEBUG("Can't register agent for class %d", mgmt);
 
diff --git a/libibmad/src/resolve.c b/libibmad/src/resolve.c
index bccd938acc5f24..542aa16167c872 100644
--- a/libibmad/src/resolve.c
+++ b/libibmad/src/resolve.c
@@ -153,7 +153,7 @@ int ib_resolve_portid_str_via(ib_portid_t * portid, char *addr_str,
 
 	switch (dest_type) {
 	case IB_DEST_LID:
-		lid = strtol(addr_str, 0, 0);
+		lid = strtol(addr_str, NULL, 0);
 		if (!IB_LID_VALID(lid)) {
 			errno = EINVAL;
 			return -1;
@@ -168,7 +168,7 @@ int ib_resolve_portid_str_via(ib_portid_t * portid, char *addr_str,
 		return 0;
 
 	case IB_DEST_GUID:
-		if (!(guid = strtoull(addr_str, 0, 0))) {
+		if (!(guid = strtoull(addr_str, NULL, 0))) {
 			errno = EINVAL;
 			return -1;
 		}
@@ -186,7 +186,7 @@ int ib_resolve_portid_str_via(ib_portid_t * portid, char *addr_str,
 		ib_portid_set(portid, lid, 0, 0);
 
 		/* handle DR parsing and set DrSLID to local lid */
-		if (ib_resolve_self_via(&selfportid, &selfport, 0, srcport) < 0)
+		if (ib_resolve_self_via(&selfportid, &selfport, NULL, srcport) < 0)
 			return -1;
 		if (str2drpath(&portid->drpath, routepath, selfportid.lid, 0) <
 		    0) {
diff --git a/libibmad/src/rpc.c b/libibmad/src/rpc.c
index 0dd4c92ac4d59f..a05d71ffe12d5b 100644
--- a/libibmad/src/rpc.c
+++ b/libibmad/src/rpc.c
@@ -136,7 +136,7 @@ _do_madrpc(int port_id, void *sndbuf, void *rcvbuf, int agentid, int len,
 	if (save_mad) {
 		memcpy(save_mad, umad_get_mad(sndbuf),
 		       save_mad_len < len ? save_mad_len : len);
-		save_mad = 0;
+		save_mad = NULL;
 	}
 
 	if (max_retries <= 0) {
@@ -227,7 +227,7 @@ void *mad_rpc(const struct ibmad_port *port, ib_rpc_t * rpc,
 		len = 0;
 		memset(sndbuf, 0, umad_size() + IB_MAD_SIZE);
 
-		if ((len = mad_build_pkt(sndbuf, rpc, dport, 0, payload)) < 0)
+		if ((len = mad_build_pkt(sndbuf, rpc, dport, NULL, payload)) < 0)
 			return NULL;
 
 		if ((len = _do_madrpc(port->port_id, sndbuf, rcvbuf,
diff --git a/libibmad/src/sa.c b/libibmad/src/sa.c
index 352ed9fea86ec1..09bf58824ae530 100644
--- a/libibmad/src/sa.c
+++ b/libibmad/src/sa.c
@@ -73,7 +73,7 @@ uint8_t *sa_rpc_call(const struct ibmad_port *ibmad_port, void *rcvbuf,
 	if (!portid->qkey)
 		portid->qkey = IB_DEFAULT_QP1_QKEY;
 
-	p = mad_rpc_rmpp(ibmad_port, &rpc, portid, 0 /*&sa->rmpp */ , rcvbuf);	/* TODO: RMPP */
+	p = mad_rpc_rmpp(ibmad_port, &rpc, portid, NULL /*&sa->rmpp */ , rcvbuf);	/* TODO: RMPP */
 
 	sa->recsz = rpc.recsz;
 
diff --git a/libibmad/src/serv.c b/libibmad/src/serv.c
index 6da8163b6944cb..74dbc8b519b385 100644
--- a/libibmad/src/serv.c
+++ b/libibmad/src/serv.c
@@ -151,7 +151,7 @@ int mad_respond_via(void *umad, ib_portid_t * portid, uint32_t rstatus,
 	     portid->qp, rpc.mgtclass, rpc.method, rpc.attr.id, rpc.attr.mod,
 	     rpc.datasz, rpc.dataoffs, portid->qkey);
 
-	if (mad_build_pkt(umad, &rpc, portid, 0, 0) < 0)
+	if (mad_build_pkt(umad, &rpc, portid, NULL, NULL) < 0)
 		return -1;
 
 	if (ibdebug > 1)
@@ -183,7 +183,7 @@ void *mad_receive_via(void *umad, int timeout, struct ibmad_port *srcport)
 		if (!umad)
 			umad_free(mad);
 		DEBUG("recv failed: %s", strerror(errno));
-		return 0;
+		return NULL;
 	}
 
 	return mad;
diff --git a/libibmad/src/vendor.c b/libibmad/src/vendor.c
index 22d6843e23e8d3..939cc2a7b3b125 100644
--- a/libibmad/src/vendor.c
+++ b/libibmad/src/vendor.c
@@ -102,10 +102,10 @@ uint8_t *ib_vendor_call_via(void *data, ib_portid_t * portid,
 		portid->qkey = IB_DEFAULT_QP1_QKEY;
 
 	if (resp_expected) {
-		p_ret = mad_rpc_rmpp(srcport, rpcold, portid, 0, data);	/* FIXME: no RMPP for now */
+		p_ret = mad_rpc_rmpp(srcport, rpcold, portid, NULL, data);	/* FIXME: no RMPP for now */
 		errno = rpc.error;
 		return p_ret;
 	}
 
-	return mad_send_via(rpcold, portid, 0, data, srcport) < 0 ? 0 : data;	/* FIXME: no RMPP for now */
+	return mad_send_via(rpcold, portid, NULL, data, srcport) < 0 ? NULL : data;	/* FIXME: no RMPP for now */
 }
diff --git a/libibnetdisc/src/chassis.c b/libibnetdisc/src/chassis.c
index 63eacf434a663d..c1eef73664a377 100644
--- a/libibnetdisc/src/chassis.c
+++ b/libibnetdisc/src/chassis.c
@@ -763,7 +763,7 @@ static int fill_voltaire_chassis_record(ibnd_node_t * node)
 {
 	int p = 0;
 	ibnd_port_t *port;
-	ibnd_node_t *remnode = 0;
+	ibnd_node_t *remnode = NULL;
 
 	if (node->ch_found)	/* somehow this node has already been passed */
 		return 0;
@@ -1005,8 +1005,8 @@ static void pass_on_spines_interpolate_chguid(ibnd_chassis_t * chassis)
 static int build_chassis(ibnd_node_t * node, ibnd_chassis_t * chassis)
 {
 	int p = 0;
-	ibnd_node_t *remnode = 0;
-	ibnd_port_t *port = 0;
+	ibnd_node_t *remnode = NULL;
+	ibnd_port_t *port = NULL;
 
 	/* we get here with node = chassis_spine */
 	if (insert_spine(node, chassis))
diff --git a/libibnetdisc/src/query_smp.c b/libibnetdisc/src/query_smp.c
index f6b632905084dc..26a5909524f777 100644
--- a/libibnetdisc/src/query_smp.c
+++ b/libibnetdisc/src/query_smp.c
@@ -225,14 +225,14 @@ int smp_engine_init(smp_engine_t * engine, char * ca_name, int ca_port,
 	}
 
 	if ((engine->smi_agent = umad_register(engine->umad_fd,
-	     IB_SMI_CLASS, 1, 0, 0)) < 0) {
+	     IB_SMI_CLASS, 1, 0, NULL)) < 0) {
 		IBND_ERROR("Failed to register SMI agent on (%s:%d)\n",
 			   ca_name, ca_port);
 		goto eio_close;
 	}
 
 	if ((engine->smi_dir_agent = umad_register(engine->umad_fd,
-	     IB_SMI_DIRECT_CLASS, 1, 0, 0)) < 0) {
+	     IB_SMI_DIRECT_CLASS, 1, 0, NULL)) < 0) {
 		IBND_ERROR("Failed to register SMI_DIRECT agent on (%s:%d)\n",
 			   ca_name, ca_port);
 		goto eio_close;
diff --git a/libibnetdisc/test/testleaks.c b/libibnetdisc/test/testleaks.c
index 35157e0ba6d420..508c5ae2e84112 100644
--- a/libibnetdisc/test/testleaks.c
+++ b/libibnetdisc/test/testleaks.c
@@ -75,7 +75,7 @@ int main(int argc, char **argv)
 {
 	struct ibnd_config config = { 0 };
 	int rc = 0;
-	char *ca = 0;
+	char *ca = NULL;
 	int ca_port = 0;
 	ibnd_fabric_t *fabric = NULL;
 	char *from = NULL;
@@ -84,18 +84,18 @@ int main(int argc, char **argv)
 
 	static char const str_opts[] = "S:D:n:C:P:t:shuf:i:";
 	static const struct option long_opts[] = {
-		{"S", 1, 0, 'S'},
-		{"D", 1, 0, 'D'},
-		{"num-hops", 1, 0, 'n'},
-		{"ca-name", 1, 0, 'C'},
-		{"ca-port", 1, 0, 'P'},
-		{"timeout", 1, 0, 't'},
-		{"show", 0, 0, 's'},
-		{"help", 0, 0, 'h'},
-		{"usage", 0, 0, 'u'},
-		{"debug", 0, 0, 2},
-		{"from", 1, 0, 'f'},
-		{"iters", 1, 0, 'i'},
+		{"S", 1, NULL, 'S'},
+		{"D", 1, NULL, 'D'},
+		{"num-hops", 1, NULL, 'n'},
+		{"ca-name", 1, NULL, 'C'},
+		{"ca-port", 1, NULL, 'P'},
+		{"timeout", 1, NULL, 't'},
+		{"show", 0, NULL, 's'},
+		{"help", 0, NULL, 'h'},
+		{"usage", 0, NULL, 'u'},
+		{"debug", 0, NULL, 2},
+		{"from", 1, NULL, 'f'},
+		{"iters", 1, NULL, 'i'},
 		{}
 	};
 
@@ -118,7 +118,7 @@ int main(int argc, char **argv)
 			ca = strdup(optarg);
 			break;
 		case 'P':
-			ca_port = strtoul(optarg, 0, 0);
+			ca_port = strtoul(optarg, NULL, 0);
 			break;
 		case 'n':
 			config.max_hops = strtoul(optarg, NULL, 0);
@@ -127,7 +127,7 @@ int main(int argc, char **argv)
 			iters = (int)strtol(optarg, NULL, 0);
 			break;
 		case 't':
-			config.timeout_ms = strtoul(optarg, 0, 0);
+			config.timeout_ms = strtoul(optarg, NULL, 0);
 			break;
 		default:
 			usage();
diff --git a/src/dump_fts.c b/src/dump_fts.c
index 199403ab392f64..88f186f7d8921e 100644
--- a/src/dump_fts.c
+++ b/src/dump_fts.c
@@ -431,7 +431,7 @@ int main(int argc, char **argv)
 		 "do not try to resolve destinations"},
 		{"Multicast", 'M', 0, NULL, "show multicast forwarding tables"},
 		{"node-name-map", 1, 1, "<file>", "node name map file"},
-		{0}
+		{}
 	};
 	char usage_args[] = "[<dest dr_path|lid|guid> [<startlid> [<endlid>]]]";
 	const char *usage_examples[] = {
@@ -454,9 +454,9 @@ int main(int argc, char **argv)
 	argv += optind;
 
 	if (argc > 0)
-		startlid = strtoul(argv[0], 0, 0);
+		startlid = strtoul(argv[0], NULL, 0);
 	if (argc > 1)
-		endlid = strtoul(argv[1], 0, 0);
+		endlid = strtoul(argv[1], NULL, 0);
 
 	node_name_map = open_node_name_map(node_name_map_file);
 
diff --git a/src/ibaddr.c b/src/ibaddr.c
index 509f0feab6981d..4c2b67c7428d6f 100644
--- a/src/ibaddr.c
+++ b/src/ibaddr.c
@@ -119,7 +119,7 @@ int main(int argc, char **argv)
 		{"gid_show", 'g', 0, NULL, "show gid address only"},
 		{"lid_show", 'l', 0, NULL, "show lid range only"},
 		{"Lid_show", 'L', 0, NULL, "show lid range (in decimal) only"},
-		{0}
+		{}
 	};
 	char usage_args[] = "[<lid|dr_path|guid>]";
 	const char *usage_examples[] = {
@@ -139,7 +139,7 @@ int main(int argc, char **argv)
 	argv += optind;
 
 	if (argc > 1)
-		port = strtoul(argv[1], 0, 0);
+		port = strtoul(argv[1], NULL, 0);
 
 	if (!show_lid && !show_gid)
 		show_lid = show_gid = 1;
diff --git a/src/ibcacheedit.c b/src/ibcacheedit.c
index 6e04efc7575d68..03e4a7efeaeae5 100644
--- a/src/ibcacheedit.c
+++ b/src/ibcacheedit.c
@@ -86,8 +86,8 @@ static int parse_beforeafter(char *arg, uint64_t *before, uint64_t *after)
 	before_str = arg;
 	after_str = ptr + 1;
 
-	(*before) = strtoull(before_str, 0, 0);
-	(*after) = strtoull(after_str, 0, 0);
+	(*before) = strtoull(before_str, NULL, 0);
+	(*after) = strtoull(after_str, NULL, 0);
 	return 0;
 }
 
@@ -119,9 +119,9 @@ static int parse_guidbeforeafter(char *arg,
 	(*ptr2) = '\0';
 	after_str = ptr2 + 1;
 
-	(*guid) = strtoull(guid_str, 0, 0);
-	(*before) = strtoull(before_str, 0, 0);
-	(*after) = strtoull(after_str, 0, 0);
+	(*guid) = strtoull(guid_str, NULL, 0);
+	(*before) = strtoull(before_str, NULL, 0);
+	(*after) = strtoull(after_str, NULL, 0);
 	return 0;
 }
 
@@ -264,7 +264,7 @@ int main(int argc, char **argv)
 		 "Specify before and after sysimgguid to edit"},
 		{"portguid", 4, 1, "NODEGUID:BEFOREGUID:AFTERGUID",
 		 "Specify before and after port guid to edit"},
-		{0}
+		{}
 	};
 	const char *usage_args = "<orig.cache> <new.cache>";
 
diff --git a/src/ibccconfig.c b/src/ibccconfig.c
index a256ceaa6f3949..296d3f791419d7 100644
--- a/src/ibccconfig.c
+++ b/src/ibccconfig.c
@@ -74,7 +74,7 @@ static const match_rec_t match_tbl[] = {
 	 "<trigger_threshold> <ccti_min>"},
 	{"CongestionControlTable", "CT", congestion_control_table, 0,
 	 "<cctilimit> <index> <cctentry> <cctentry> ..."},
-	{0}
+	{}
 };
 
 static uint64_t cckey;
@@ -548,7 +548,7 @@ static int process_opt(void *context, int ch)
 {
 	switch (ch) {
 	case 'c':
-		cckey = (uint64_t) strtoull(optarg, 0, 0);
+		cckey = (uint64_t) strtoull(optarg, NULL, 0);
 		break;
 	default:
 		return -1;
@@ -568,7 +568,7 @@ int main(int argc, char **argv)
 
 	const struct ibdiag_opt opts[] = {
 		{"cckey", 'c', 1, "<key>", "CC key"},
-		{0}
+		{}
 	};
 	const char *usage_examples[] = {
 		"SwitchCongestionSetting 2 0x1F 0x1FFFFFFFFF 0x0 0xF 8 0 0:0 1\t# Configure Switch Congestion Settings",
diff --git a/src/ibccquery.c b/src/ibccquery.c
index a80cd01bdea5f5..390ea71d55b0df 100644
--- a/src/ibccquery.c
+++ b/src/ibccquery.c
@@ -72,7 +72,7 @@ static const match_rec_t match_tbl[] = {
 	{"CACongestionSetting", "CS", ca_congestion_setting, 0, ""},
 	{"CongestionControlTable", "CT", congestion_control_table, 0, ""},
 	{"Timestamp", "TI", timestamp_dump, 0, ""},
-	{0}
+	{}
 };
 
 static uint64_t cckey = 0;
@@ -205,7 +205,7 @@ static const char *switch_port_congestion_setting(ib_portid_t *dest,
 	int outputcount = 0;
 
 	if (argc > 0)
-		portnum = strtol(argv[0], 0, 0);
+		portnum = strtol(argv[0], NULL, 0);
 
 	/* Figure out number of ports first */
 	if (!smp_query_via(data, dest, IB_ATTR_NODE_INFO, 0, 0, srcport))
@@ -343,7 +343,7 @@ static int process_opt(void *context, int ch)
 {
 	switch (ch) {
 	case 'c':
-		cckey = (uint64_t) strtoull(optarg, 0, 0);
+		cckey = (uint64_t) strtoull(optarg, NULL, 0);
 		break;
 	default:
 		return -1;
@@ -363,7 +363,7 @@ int main(int argc, char **argv)
 
 	const struct ibdiag_opt opts[] = {
 		{"cckey", 'c', 1, "<key>", "CC key"},
-		{0}
+		{}
 	};
 	const char *usage_examples[] = {
 		"CongestionInfo 3\t\t\t# Congestion Info by lid",
diff --git a/src/ibdiag_common.c b/src/ibdiag_common.c
index cdb099dd3771a3..293b9afce0a021 100644
--- a/src/ibdiag_common.c
+++ b/src/ibdiag_common.c
@@ -160,10 +160,10 @@ static void read_ibdiag_config(const char *file)
 				ibd_ibnetdisc_flags &= ~IBND_CONFIG_MLX_EPI;
 			}
 		} else if (strncmp(name, "m_key", strlen("m_key")) == 0) {
-			ibd_mkey = strtoull(val_str, 0, 0);
+			ibd_mkey = strtoull(val_str, NULL, 0);
 		} else if (strncmp(name, "sa_key",
 				   strlen("sa_key")) == 0) {
-			ibd_sakey = strtoull(val_str, 0, 0);
+			ibd_sakey = strtoull(val_str, NULL, 0);
 		} else if (strncmp(name, "nd_format",
 				   strlen("nd_format")) == 0) {
 			ibd_nd_format = strdup(val_str);
@@ -242,7 +242,7 @@ static int process_opt(int ch)
 		ibd_ca = optarg;
 		break;
 	case 'P':
-		ibd_ca_port = strtoul(optarg, 0, 0);
+		ibd_ca_port = strtoul(optarg, NULL, 0);
 		break;
 	case 'D':
 		ibd_dest_type = IB_DEST_DRPATH;
@@ -268,7 +268,7 @@ static int process_opt(int ch)
 	case 's':
 		/* srcport is not required when resolving via IB_DEST_LID */
 		if (resolve_portid_str(ibd_ca, ibd_ca_port, &sm_portid, optarg,
-				IB_DEST_LID, 0, NULL) < 0)
+				IB_DEST_LID, NULL, NULL) < 0)
 			IBEXIT("cannot resolve SM destination port %s",
 				optarg);
 		ibd_sm_id = &sm_portid;
@@ -310,7 +310,7 @@ static const struct ibdiag_opt common_opts[] = {
 	{"debug", 'd', 0, NULL, "raise debug level"},
 	{"help", 'h', 0, NULL, "help message"},
 	{"version", 'V', 0, NULL, "show version"},
-	{0}
+	{}
 };
 
 static void make_opt(struct option *l, const struct ibdiag_opt *o,
@@ -704,7 +704,7 @@ int resolve_portid_str(char *ca_name, uint8_t ca_port, ib_portid_t * portid,
 
 	switch (dest_type) {
 	case IB_DEST_LID:
-		lid = strtol(addr_str, 0, 0);
+		lid = strtol(addr_str, NULL, 0);
 		if (!IB_LID_VALID(lid))
 			return -1;
 		return ib_portid_set(portid, lid, 0, 0);
@@ -715,7 +715,7 @@ int resolve_portid_str(char *ca_name, uint8_t ca_port, ib_portid_t * portid,
 		return 0;
 
 	case IB_DEST_GUID:
-		if (!(guid = strtoull(addr_str, 0, 0)))
+		if (!(guid = strtoull(addr_str, NULL, 0)))
 			return -1;
 
 		/* keep guid in portid? */
diff --git a/src/iblinkinfo.c b/src/iblinkinfo.c
index b7c67e6a5d83ad..7060959993b0e9 100644
--- a/src/iblinkinfo.c
+++ b/src/iblinkinfo.c
@@ -563,7 +563,7 @@ static int process_opt(void *context, int ch)
 	case 'S':
 	case 'G':
 		node_label.guid_str = optarg;
-		node_label.guid = (uint64_t)strtoull(node_label.guid_str, 0, 0);
+		node_label.guid = (uint64_t)strtoull(node_label.guid_str, NULL, 0);
 		break;
 	case 'D':
 		dr_path = strdup(optarg);
@@ -640,7 +640,7 @@ int main(int argc, char **argv)
 		 "Output only switches"},
 		{"cas-only", 7, 0, NULL,
 		 "Output only CAs"},
-		{0}
+		{}
 	};
 	char usage_args[] = "";
 
diff --git a/src/ibnetdiscover.c b/src/ibnetdiscover.c
index 9a5b3d515c32c3..ba2e04a15783c8 100644
--- a/src/ibnetdiscover.c
+++ b/src/ibnetdiscover.c
@@ -550,7 +550,7 @@ static int dump_topology(int group, ibnd_fabric_t *fabric)
 	ibnd_node_t *node;
 	ibnd_port_t *port;
 	int i = 0, p = 0;
-	time_t t = time(0);
+	time_t t = time(NULL);
 	uint64_t chguid;
 	char *chname = NULL;
 	struct iter_user_data iter_user_data;
@@ -1100,7 +1100,7 @@ int main(int argc, char **argv)
 		{"outstanding_smps", 'o', 1, NULL,
 		 "specify the number of outstanding SMP's which should be "
 		 "issued during the scan"},
-		{0}
+		{}
 	};
 	char usage_args[] = "[topology-file]";
 
diff --git a/src/ibping.c b/src/ibping.c
index 2ba17313c00842..9a236fe8233f85 100644
--- a/src/ibping.c
+++ b/src/ibping.c
@@ -89,7 +89,7 @@ static char *ibping_serv(void)
 
 	DEBUG("starting to serve...");
 
-	while ((umad = mad_receive_via(0, -1, srcport))) {
+	while ((umad = mad_receive_via(NULL, -1, srcport))) {
 
 		if (umad_status(umad) == 0) {
 			mad = umad_get_mad(umad);
@@ -99,7 +99,7 @@ static char *ibping_serv(void)
 
 			DEBUG("Pong: %s", data);
 
-			if (mad_respond_via(umad, 0, 0, srcport) < 0)
+			if (mad_respond_via(umad, NULL, 0, srcport) < 0)
 				DEBUG("respond failed");
 
 		}
@@ -107,7 +107,7 @@ static char *ibping_serv(void)
 	}
 
 	DEBUG("server out");
-	return 0;
+	return NULL;
 }
 
 static int oui = IB_OPENIB_OUI;
@@ -178,13 +178,13 @@ static int process_opt(void *context, int ch)
 {
 	switch (ch) {
 	case 'c':
-		count = strtoul(optarg, 0, 0);
+		count = strtoul(optarg, NULL, 0);
 		break;
 	case 'f':
 		flood++;
 		break;
 	case 'o':
-		oui = strtoul(optarg, 0, 0);
+		oui = strtoul(optarg, NULL, 0);
 		break;
 	case 'S':
 		server++;
@@ -207,7 +207,7 @@ int main(int argc, char **argv)
 		{"flood", 'f', 0, NULL, "flood destination"},
 		{"oui", 'o', 1, NULL, "use specified OUI number"},
 		{"Server", 'S', 0, NULL, "start in server mode"},
-		{0}
+		{}
 	};
 	char usage_args[] = "<dest lid|guid>";
 
@@ -225,7 +225,7 @@ int main(int argc, char **argv)
 		IBEXIT("Failed to open '%s' port '%d'", ibd_ca, ibd_ca_port);
 
 	if (server) {
-		if (mad_register_server_via(ping_class, 0, 0, oui, srcport) < 0)
+		if (mad_register_server_via(ping_class, 0, NULL, oui, srcport) < 0)
 			IBEXIT("can't serve class %d on this port",
 				ping_class);
 
diff --git a/src/ibportstate.c b/src/ibportstate.c
index 680c7e78f95a7a..cfe30655e67fd5 100644
--- a/src/ibportstate.c
+++ b/src/ibportstate.c
@@ -433,7 +433,7 @@ int main(int argc, char **argv)
 		IBEXIT("can't resolve destination port %s", argv[0]);
 
 	if (argc > 1)
-		portnum = strtol(argv[1], 0, 0);
+		portnum = strtol(argv[1], NULL, 0);
 
 	for (i = 2; i < argc; i++) {
 		int j;
@@ -455,7 +455,7 @@ int main(int argc, char **argv)
 			if (++i >= argc)
 				IBEXIT("%s requires an additional parameter",
 					port_args[j].name);
-			val = strtoull(argv[i], 0, 0);
+			val = strtoull(argv[i], NULL, 0);
 			switch (j) {
 			case SPEED:
 				if (val > 15)
@@ -687,7 +687,7 @@ int main(int argc, char **argv)
 
 				/* Set DrSLID to local lid */
 				if (resolve_self(ibd_ca, ibd_ca_port, &selfportid,
-						         &selfport, 0) < 0)
+						         &selfport, NULL) < 0)
 					IBEXIT("could not resolve self");
 				peerportid.drpath.drslid = (uint16_t) selfportid.lid;
 				peerportid.drpath.drdlid = 0xffff;
diff --git a/src/ibqueryerrors.c b/src/ibqueryerrors.c
index 6cd652670977b4..bbae886b9f69d8 100644
--- a/src/ibqueryerrors.c
+++ b/src/ibqueryerrors.c
@@ -945,7 +945,7 @@ static int process_opt(void *context, int ch)
 	case 'G':
 	case 'S':
 		port_guid_str = optarg;
-		port_guid = strtoull(optarg, 0, 0);
+		port_guid = strtoull(optarg, NULL, 0);
 		break;
 	case 'D':
 		dr_path = strdup(optarg);
@@ -1020,7 +1020,7 @@ int main(int argc, char **argv)
 		{"outstanding_smps", 'o', 1, NULL,
 		 "specify the number of outstanding SMP's which should be "
 		 "issued during the scan"},
-		{0}
+		{}
 	};
 	char usage_args[] = "";
 
diff --git a/src/ibroute.c b/src/ibroute.c
index e433faffc7a1eb..798abd80923a24 100644
--- a/src/ibroute.c
+++ b/src/ibroute.c
@@ -84,7 +84,7 @@ static const char *check_switch(ib_portid_t *portid, unsigned int *nports,
 	if (!smp_query_via(sw, portid, IB_ATTR_SWITCH_INFO, 0, 0, srcport))
 		return "switch info failed: is a switch node?";
 
-	return 0;
+	return NULL;
 }
 
 #define IB_MLIDS_IN_BLOCK	(IB_SMP_DATA_SIZE/2)
@@ -243,7 +243,7 @@ static const char *dump_multicast_tables(ib_portid_t *portid, unsigned startlid,
 	printf("%d %smlids dumped \n", n, dump_all ? "" : "valid ");
 
 	free(mapnd);
-	return 0;
+	return NULL;
 }
 
 static int dump_lid(char *str, int strlen, int lid, int valid)
@@ -392,7 +392,7 @@ static const char *dump_unicast_tables(ib_portid_t *portid, int startlid,
 
 	printf("%d %slids dumped \n", n, dump_all ? "" : "valid ");
 	free(mapnd);
-	return 0;
+	return NULL;
 }
 
 static int process_opt(void *context, int ch)
@@ -432,7 +432,7 @@ int main(int argc, char **argv)
 		 "do not try to resolve destinations"},
 		{"Multicast", 'M', 0, NULL, "show multicast forwarding tables"},
 		{"node-name-map", 1, 1, "<file>", "node name map file"},
-		{0}
+		{}
 	};
 	char usage_args[] = "[<dest dr_path|lid|guid> [<startlid> [<endlid>]]]";
 	const char *usage_examples[] = {
@@ -461,9 +461,9 @@ int main(int argc, char **argv)
 		ibdiag_show_usage();
 
 	if (argc > 1)
-		startlid = strtoul(argv[1], 0, 0);
+		startlid = strtoul(argv[1], NULL, 0);
 	if (argc > 2)
-		endlid = strtoul(argv[2], 0, 0);
+		endlid = strtoul(argv[2], NULL, 0);
 
 	node_name_map = open_node_name_map(node_name_map_file);
 
diff --git a/src/ibstat.c b/src/ibstat.c
index 308e29118df654..0e79f21c544c52 100644
--- a/src/ibstat.c
+++ b/src/ibstat.c
@@ -287,7 +287,7 @@ int main(int argc, char *argv[])
 		{"list_of_cas", 'l', 0, NULL, "list all IB devices"},
 		{"short", 's', 0, NULL, "short output"},
 		{"port_list", 'p', 0, NULL, "show port list"},
-		{0}
+		{}
 	};
 	char usage_args[] = "<ca_name> [portnum]";
 	const char *usage_examples[] = {
@@ -303,7 +303,7 @@ int main(int argc, char *argv[])
 	argv += optind;
 
 	if (argc > 1)
-		dev_port = strtol(argv[1], 0, 0);
+		dev_port = strtol(argv[1], NULL, 0);
 
 	if (umad_init() < 0)
 		IBPANIC("can't init UMAD library");
diff --git a/src/ibsysstat.c b/src/ibsysstat.c
index 501a629c0a154f..4d8267e2eba4ed 100644
--- a/src/ibsysstat.c
+++ b/src/ibsysstat.c
@@ -97,7 +97,7 @@ static int server_respond(void *umad, int size)
 	DEBUG("responding %d bytes to %s, attr 0x%x mod 0x%x qkey %x",
 	      size, portid2str(&rport), rpc.attr.id, rpc.attr.mod, rport.qkey);
 
-	if (mad_build_pkt(umad, &rpc, &rport, &rmpp, 0) < 0)
+	if (mad_build_pkt(umad, &rpc, &rport, &rmpp, NULL) < 0)
 		return -1;
 
 	if (ibdebug > 1)
@@ -196,7 +196,7 @@ static char *ibsystat_serv(void)
 	}
 
 	DEBUG("server out");
-	return 0;
+	return NULL;
 }
 
 static int match_attr(char *str)
@@ -253,7 +253,7 @@ static char *ibsystat(ib_portid_t * portid, int attr)
 		puts(data);
 	else
 		printf("sysstat ping succeeded\n");
-	return 0;
+	return NULL;
 }
 
 static int build_cpuinfo(void)
@@ -299,7 +299,7 @@ static int process_opt(void *context, int ch)
 {
 	switch (ch) {
 	case 'o':
-		oui = strtoul(optarg, 0, 0);
+		oui = strtoul(optarg, NULL, 0);
 		break;
 	case 'S':
 		server++;
@@ -322,7 +322,7 @@ int main(int argc, char **argv)
 	const struct ibdiag_opt opts[] = {
 		{"oui", 'o', 1, NULL, "use specified OUI number"},
 		{"Server", 'S', 0, NULL, "start in server mode"},
-		{0}
+		{}
 	};
 	char usage_args[] = "<dest lid|guid> [<op>]";
 
@@ -343,7 +343,7 @@ int main(int argc, char **argv)
 		IBEXIT("Failed to open '%s' port '%d'", ibd_ca, ibd_ca_port);
 
 	if (server) {
-		if (mad_register_server_via(sysstat_class, 1, 0, oui, srcport) <
+		if (mad_register_server_via(sysstat_class, 1, NULL, oui, srcport) <
 		    0)
 			IBEXIT("can't serve class %d", sysstat_class);
 
diff --git a/src/ibtracert.c b/src/ibtracert.c
index d8d45408cd716c..a21ee8e7724865 100644
--- a/src/ibtracert.c
+++ b/src/ibtracert.c
@@ -554,18 +554,18 @@ static Node *find_mcpath(ib_portid_t * from, int mlid)
 
 	if (get_node(node, port, from) < 0) {
 		IBWARN("can't reach node %s", portid2str(from));
-		return 0;
+		return NULL;
 	}
 
-	node->upnode = 0;	/* root */
+	node->upnode = NULL;	/* root */
 	if ((r = new_node(node, port, from, 0)) > 0) {
 		if (node->type != IB_NODE_SWITCH) {
 			IBWARN("ibtracert from CA to CA is unsupported");
-			return 0;	/* ibtracert from host to itself is unsupported */
+			return NULL;	/* ibtracert from host to itself is unsupported */
 		}
 
 		if (switch_mclookup(node, from, mlid, map) < 0 || !map[0])
-			return 0;
+			return NULL;
 		return node;
 	}
 
@@ -620,7 +620,7 @@ static Node *find_mcpath(ib_portid_t * from, int mlid)
 						    ("can't reach node %s port %d",
 						     portid2str(path), i);
 						free(port);
-						return 0;
+						return NULL;
 					}
 
 					if (port->physstate != 5) {	/* LinkUP */
@@ -633,7 +633,7 @@ static Node *find_mcpath(ib_portid_t * from, int mlid)
 
 					if (extend_dpath(&path->drpath, i) < 0) {
 						free(port);
-						return 0;
+						return NULL;
 					}
 				}
 
@@ -674,7 +674,7 @@ static Node *find_mcpath(ib_portid_t * from, int mlid)
 		}
 	}
 
-	return 0;		/* not found */
+	return NULL;		/* not found */
 }
 
 static uint64_t find_target_portguid(ib_portid_t * to)
@@ -770,7 +770,7 @@ static int process_opt(void *context, int ch)
 		break;
 	case 'm':
 		multicast++;
-		mlid = strtoul(optarg, 0, 0);
+		mlid = strtoul(optarg, NULL, 0);
 		break;
 	case 'f':
 		force++;
@@ -875,7 +875,7 @@ int main(int argc, char **argv)
 		{"mlid", 'm', 1, "<mlid>", "multicast trace of the mlid"},
 		{"node-name-map", 1, 1, "<file>", "node name map file"},
 		{"ports-file", 2, 1, "<file>", "port pairs file"},
-		{0}
+		{}
 	};
 	char usage_args[] = "<src-addr> <dest-addr>";
 	const char *usage_examples[] = {
diff --git a/src/perfquery.c b/src/perfquery.c
index 7ce6a3f4d311d9..7f7ca951b01094 100644
--- a/src/perfquery.c
+++ b/src/perfquery.c
@@ -834,7 +834,7 @@ int main(int argc, char **argv)
 		{"loop_ports", 'l', 0, NULL, "iterate through each port"},
 		{"reset_after_read", 'r', 0, NULL, "reset counters after read"},
 		{"Reset_only", 'R', 0, NULL, "only reset counters"},
-		{0}
+		{}
 	};
 	char usage_args[] = " [<lid|guid> [[port(s)] [reset_mask]]]";
 	const char *usage_examples[] = {
@@ -867,7 +867,7 @@ int main(int argc, char **argv)
 			tmpstr = strtok(argv[1], ",");
 			while (tmpstr) {
 				info.ports[info.ports_count++] =
-					strtoul(tmpstr, 0, 0);
+					strtoul(tmpstr, NULL, 0);
 				tmpstr = strtok(NULL, ",");
 			}
 			info.port = info.ports[0];
@@ -878,8 +878,8 @@ int main(int argc, char **argv)
 			*tmpstr = '\0';
 			tmpstr++;
 
-			pmin = strtoul(argv[1], 0, 0);
-			pmax = strtoul(tmpstr, 0, 0);
+			pmin = strtoul(argv[1], NULL, 0);
+			pmax = strtoul(tmpstr, NULL, 0);
 
 			if (pmin >= pmax)
 				IBEXIT("max port must be greater than min port in range");
@@ -890,10 +890,10 @@ int main(int argc, char **argv)
 			info.port = info.ports[0];
 		}
 		else
-			info.port = strtoul(argv[1], 0, 0);
+			info.port = strtoul(argv[1], NULL, 0);
 	}
 	if (argc > 2) {
-		ext_mask = strtoull(argv[2], 0, 0);
+		ext_mask = strtoull(argv[2], NULL, 0);
 		mask = ext_mask;
 	}
 
@@ -908,7 +908,7 @@ int main(int argc, char **argv)
 				       ibd_dest_type, ibd_sm_id, srcport) < 0)
 			IBEXIT("can't resolve destination port %s", argv[0]);
 	} else {
-		if (resolve_self(ibd_ca, ibd_ca_port, &portid, &info.port, 0) <
+		if (resolve_self(ibd_ca, ibd_ca_port, &portid, &info.port, NULL) <
 		    0)
 			IBEXIT("can't resolve self port %s", argv[0]);
 	}
diff --git a/src/saquery.c b/src/saquery.c
index 8eae9ddd20083f..ae6c2c872e8d90 100644
--- a/src/saquery.c
+++ b/src/saquery.c
@@ -203,7 +203,7 @@ static void print_node_record(ib_node_record_t * node_record)
 		break;
 	}
 
-	dump_node_record(node_record, 0);
+	dump_node_record(node_record, NULL);
 }
 
 static void dump_path_record(void *data, struct query_params *p)
@@ -1481,7 +1481,7 @@ static const struct query_cmd query_cmds[] = {
 	 "[lid]", query_switchinfo_records},
 	{"SMInfoRecord", "SMIR", IB_SA_ATTR_SMINFORECORD,
 	 "[lid]", query_sm_info_records},
-	{0}
+	{}
 };
 
 static const struct query_cmd *find_query(const char *name)
@@ -1780,7 +1780,7 @@ int main(int argc, char **argv)
 		{"join_state", 'J', 1, NULL, "Join state (MCMemberRecord)"},
 		{"proxy_join", 'X', 1, NULL, "Proxy join (MCMemberRecord)"},
 		{"service_id", 22, 1, NULL, "ServiceID (PathRecord)"},
-		{0}
+		{}
 	};
 
 	memset(&params, 0, sizeof params);
diff --git a/src/sminfo.c b/src/sminfo.c
index 24c4950085879f..494c95be239e91 100644
--- a/src/sminfo.c
+++ b/src/sminfo.c
@@ -75,13 +75,13 @@ static int process_opt(void *context, int ch)
 {
 	switch (ch) {
 	case 'a':
-		act = strtoul(optarg, 0, 0);
+		act = strtoul(optarg, NULL, 0);
 		break;
 	case 's':
-		state = strtoul(optarg, 0, 0);
+		state = strtoul(optarg, NULL, 0);
 		break;
 	case 'p':
-		prio = strtoul(optarg, 0, 0);
+		prio = strtoul(optarg, NULL, 0);
 		break;
 	default:
 		return -1;
@@ -102,7 +102,7 @@ int main(int argc, char **argv)
 		{"state", 's', 1, "<0-3>", "set SM state"},
 		{"priority", 'p', 1, "<0-15>", "set SM priority"},
 		{"activity", 'a', 1, NULL, "set activity count"},
-		{0}
+		{}
 	};
 	char usage_args[] = "<sm_lid|sm_dr_path> [modifier]";
 
@@ -123,7 +123,7 @@ int main(int argc, char **argv)
 
 	if (argc) {
 		if (resolve_portid_str(ibd_ca, ibd_ca_port, &portid, argv[0],
-				       ibd_dest_type, 0, srcport) < 0)
+				       ibd_dest_type, NULL, srcport) < 0)
 			IBEXIT("can't resolve destination port %s", argv[0]);
 	} else {
 		if (resolve_sm_portid(ibd_ca, ibd_ca_port, &portid) < 0)
diff --git a/src/smpdump.c b/src/smpdump.c
index beb7168bd9aab9..7c5d6ffb3d69d3 100644
--- a/src/smpdump.c
+++ b/src/smpdump.c
@@ -181,7 +181,7 @@ int main(int argc, char *argv[])
 
 	const struct ibdiag_opt opts[] = {
 		{"string", 's', 0, NULL, ""},
-		{0}
+		{}
 	};
 	char usage_args[] = "<dlid|dr_path> <attr> [mod]";
 	const char *usage_examples[] = {
@@ -210,11 +210,11 @@ int main(int argc, char *argv[])
 		IBPANIC("bad path str '%s'", argv[0]);
 
 	if (mgmt_class == IB_SMI_CLASS)
-		dlid = strtoul(argv[0], 0, 0);
+		dlid = strtoul(argv[0], NULL, 0);
 
-	attr = strtoul(argv[1], 0, 0);
+	attr = strtoul(argv[1], NULL, 0);
 	if (argc > 2)
-		mod = strtoul(argv[2], 0, 0);
+		mod = strtoul(argv[2], NULL, 0);
 
 	if (umad_init() < 0)
 		IBPANIC("can't init UMAD library");
@@ -222,7 +222,7 @@ int main(int argc, char *argv[])
 	if ((portid = umad_open_port(ibd_ca, ibd_ca_port)) < 0)
 		IBPANIC("can't open UMAD port (%s:%d)", ibd_ca, ibd_ca_port);
 
-	if ((mad_agent = umad_register(portid, mgmt_class, 1, 0, 0)) < 0)
+	if ((mad_agent = umad_register(portid, mgmt_class, 1, 0, NULL)) < 0)
 		IBPANIC("Couldn't register agent for SMPs");
 
 	if (!(umad = umad_alloc(1, umad_size() + IB_MAD_SIZE)))
@@ -249,7 +249,7 @@ int main(int argc, char *argv[])
 		fprintf(stderr, "%d bytes received\n", length);
 
 	if (!dump_char) {
-		xdump(stdout, 0, smp->data, 64);
+		xdump(stdout, NULL, smp->data, 64);
 		if (smp->status)
 			fprintf(stdout, "SMP status: 0x%x\n",
 				ntohs(smp->status));
diff --git a/src/smpquery.c b/src/smpquery.c
index ded1b391566955..3a3c1ca3fb5a65 100644
--- a/src/smpquery.c
+++ b/src/smpquery.c
@@ -67,7 +67,7 @@ static const match_rec_t match_tbl[] = {
 	{"VLArbitration", "VLArb", vlarb_table, 1, ""},
 	{"GUIDInfo", "GI", guid_info, 0, ""},
 	{"MlnxExtPortInfo", "MEPI", mlnx_ext_port_info, 1, ""},
-	{0}
+	{}
 };
 
 static char *node_name_map_file = NULL;
@@ -106,7 +106,7 @@ static const char *node_desc(ib_portid_t *dest, char **argv, int argc)
 
 	printf("Node Description:%s%s\n", dots, nodename);
 	free(nodename);
-	return 0;
+	return NULL;
 }
 
 static const char *node_info(ib_portid_t * dest, char **argv, int argc)
@@ -120,7 +120,7 @@ static const char *node_info(ib_portid_t * dest, char **argv, int argc)
 	mad_dump_nodeinfo(buf, sizeof buf, data, sizeof data);
 
 	printf("# Node info: %s\n%s", portid2str(dest), buf);
-	return 0;
+	return NULL;
 }
 
 static const char *port_info_extended(ib_portid_t *dest, char **argv, int argc)
@@ -130,7 +130,7 @@ static const char *port_info_extended(ib_portid_t *dest, char **argv, int argc)
 	int portnum = 0;
 
 	if (argc > 0)
-		portnum = strtol(argv[0], 0, 0);
+		portnum = strtol(argv[0], NULL, 0);
 
 	if (!is_port_info_extended_supported(dest, portnum, srcport))
 		return "port info extended not supported";
@@ -142,7 +142,7 @@ static const char *port_info_extended(ib_portid_t *dest, char **argv, int argc)
 	mad_dump_portinfo_ext(buf, sizeof buf, data, sizeof data);
 	printf("# Port info Extended: %s port %d\n%s", portid2str(dest),
 	       portnum, buf);
-	return 0;
+	return NULL;
 }
 
 static const char *port_info(ib_portid_t *dest, char **argv, int argc)
@@ -151,7 +151,7 @@ static const char *port_info(ib_portid_t *dest, char **argv, int argc)
 	int portnum = 0, orig_portnum;
 
 	if (argc > 0)
-		portnum = strtol(argv[0], 0, 0);
+		portnum = strtol(argv[0], NULL, 0);
 	orig_portnum = portnum;
 	if (extended_speeds)
 		portnum |= 1 << 31;
@@ -161,7 +161,7 @@ static const char *port_info(ib_portid_t *dest, char **argv, int argc)
 
 	printf("# Port info: %s port %d\n", portid2str(dest), orig_portnum);
 	dump_portinfo(data, 0);
-	return 0;
+	return NULL;
 }
 
 static const char *mlnx_ext_port_info(ib_portid_t *dest, char **argv, int argc)
@@ -171,7 +171,7 @@ static const char *mlnx_ext_port_info(ib_portid_t *dest, char **argv, int argc)
 	int portnum = 0;
 
 	if (argc > 0)
-		portnum = strtol(argv[0], 0, 0);
+		portnum = strtol(argv[0], NULL, 0);
 
 	if (!smp_query_via(data, dest, IB_ATTR_MLNX_EXT_PORT_INFO, portnum, 0, srcport))
 		return "Mellanox ext port info query failed";
@@ -179,7 +179,7 @@ static const char *mlnx_ext_port_info(ib_portid_t *dest, char **argv, int argc)
 	mad_dump_mlnx_ext_port_info(buf, sizeof buf, data, sizeof data);
 
 	printf("# MLNX ext Port info: %s port %d\n%s", portid2str(dest), portnum, buf);
-	return 0;
+	return NULL;
 }
 
 static const char *switch_info(ib_portid_t *dest, char **argv, int argc)
@@ -193,7 +193,7 @@ static const char *switch_info(ib_portid_t *dest, char **argv, int argc)
 	mad_dump_switchinfo(buf, sizeof buf, data, sizeof data);
 
 	printf("# Switch info: %s\n%s", portid2str(dest), buf);
-	return 0;
+	return NULL;
 }
 
 static const char *pkey_table(ib_portid_t *dest, char **argv, int argc)
@@ -206,7 +206,7 @@ static const char *pkey_table(ib_portid_t *dest, char **argv, int argc)
 	int portnum = 0;
 
 	if (argc > 0)
-		portnum = strtol(argv[0], 0, 0);
+		portnum = strtol(argv[0], NULL, 0);
 
 	/* Get the partition capacity */
 	if (!smp_query_via(data, dest, IB_ATTR_NODE_INFO, 0, 0, srcport))
@@ -245,7 +245,7 @@ static const char *pkey_table(ib_portid_t *dest, char **argv, int argc)
 	}
 	printf("%d pkeys capacity for this port\n", n);
 
-	return 0;
+	return NULL;
 }
 
 static const char *sl2vl_dump_table_entry(ib_portid_t *dest, int in, int out)
@@ -260,7 +260,7 @@ static const char *sl2vl_dump_table_entry(ib_portid_t *dest, int in, int out)
 	mad_dump_sltovl(buf, sizeof buf, data, sizeof data);
 	printf("ports: in %2d, out %2d: ", in, out);
 	printf("%s", buf);
-	return 0;
+	return NULL;
 }
 
 static const char *sl2vl_table(ib_portid_t *dest, char **argv, int argc)
@@ -271,7 +271,7 @@ static const char *sl2vl_table(ib_portid_t *dest, char **argv, int argc)
 	const char *ret;
 
 	if (argc > 0)
-		portnum = strtol(argv[0], 0, 0);
+		portnum = strtol(argv[0], NULL, 0);
 
 	if (!smp_query_via(data, dest, IB_ATTR_NODE_INFO, 0, 0, srcport))
 		return "node info query failed";
@@ -295,7 +295,7 @@ static const char *sl2vl_table(ib_portid_t *dest, char **argv, int argc)
 		if (ret)
 			return ret;
 	}
-	return 0;
+	return NULL;
 }
 
 static const char *vlarb_dump_table_entry(ib_portid_t *dest, int portnum,
@@ -309,7 +309,7 @@ static const char *vlarb_dump_table_entry(ib_portid_t *dest, int portnum,
 		return "vl arb query failed";
 	mad_dump_vlarbitration(buf, sizeof(buf), data, cap * 2);
 	printf("%s", buf);
-	return 0;
+	return NULL;
 }
 
 static const char *vlarb_dump_table(ib_portid_t *dest, int portnum,
@@ -334,7 +334,7 @@ static const char *vlarb_table(ib_portid_t *dest, char **argv, int argc)
 	const char *ret = NULL;
 
 	if (argc > 0)
-		portnum = strtol(argv[0], 0, 0);
+		portnum = strtol(argv[0], NULL, 0);
 
 	/* port number of 0 could mean SP0 or port MAD arrives on */
 	if (portnum == 0) {
@@ -353,7 +353,7 @@ static const char *vlarb_table(ib_portid_t *dest, char **argv, int argc)
 				printf
 				    ("# No VLArbitration tables (BSP0): %s port %d\n",
 				     portid2str(dest), 0);
-				return 0;
+				return NULL;
 			}
 			memset(data, 0, sizeof(data));
 		}
@@ -407,7 +407,7 @@ static const char *guid_info(ib_portid_t *dest, char **argv, int argc)
 	}
 	printf("%d guids capacity for this port\n", n);
 
-	return 0;
+	return NULL;
 }
 
 static int process_opt(void *context, int ch)
@@ -446,7 +446,7 @@ int main(int argc, char **argv)
 		 "use Combined route address argument"},
 		{"node-name-map", 1, 1, "<file>", "node name map file"},
 		{"extended", 'x', 0, NULL, "use extended speeds"},
-		{0}
+		{}
 	};
 	const char *usage_examples[] = {
 		"portinfo 3 1\t\t\t\t# portinfo by lid, with port modifier",
diff --git a/src/vendstat.c b/src/vendstat.c
index 0030c7caf20928..316220451055cd 100644
--- a/src/vendstat.c
+++ b/src/vendstat.c
@@ -359,7 +359,7 @@ int main(int argc, char **argv)
 		{"c", 'c', 1, "<num,num>", "configure IS4 counter groups"},
 		{"Read", 'R', 1, "<addr,mask>", "Read configuration space record at addr"},
 		{"Write", 'W', 1, "<addr,val,mask>", "Write configuration space record at addr"},
-		{0}
+		{}
 	};
 
 	char usage_args[] = "<lid|guid> [port]";
@@ -379,7 +379,7 @@ int main(int argc, char **argv)
 	argv += optind;
 
 	if (argc > 1)
-		port = strtoul(argv[1], 0, 0);
+		port = strtoul(argv[1], NULL, 0);
 
 	srcport = mad_rpc_open_port(ibd_ca, ibd_ca_port, mgmt_classes, 2);
 	if (!srcport)
@@ -392,7 +392,7 @@ int main(int argc, char **argv)
 			IBEXIT("can't resolve destination port %s", argv[0]);
 		}
 	} else {
-		if (resolve_self(ibd_ca, ibd_ca_port, &portid, &port, 0) < 0) {
+		if (resolve_self(ibd_ca, ibd_ca_port, &portid, &port, NULL) < 0) {
 			mad_rpc_close_port(srcport);
 			IBEXIT("can't resolve self port %s", argv[0]);
 		}
-- 
2.21.0




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux