[02/10] example: tm: check rc from odp init calls

Message ID 1464219423-14977-3-git-send-email-bill.fischofer@linaro.org
State Superseded
Headers show

Commit Message

Bill Fischofer May 25, 2016, 11:36 p.m.
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 example/traffic_mgmt/odp_traffic_mgmt.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

Patch

diff --git a/example/traffic_mgmt/odp_traffic_mgmt.c b/example/traffic_mgmt/odp_traffic_mgmt.c
index 9edf92e..ff03542 100644
--- a/example/traffic_mgmt/odp_traffic_mgmt.c
+++ b/example/traffic_mgmt/odp_traffic_mgmt.c
@@ -749,6 +749,7 @@  int main(int argc, char *argv[])
 	struct rlimit    rlimit;
 	uint32_t pkts_into_tm, pkts_from_tm;
 	odp_instance_t instance;
+	int rc;
 
 	memset(&signal_action, 0, sizeof(signal_action));
 	signal_action.sa_handler = signal_handler;
@@ -763,8 +764,16 @@  int main(int argc, char *argv[])
 	rlimit.rlim_cur = rlimit.rlim_max;
 	setrlimit(RLIMIT_CORE, &rlimit);
 
-	odp_init_global(&instance, &ODP_INIT_PARAMS, NULL);
-	odp_init_local(instance, ODP_THREAD_CONTROL);
+	rc = odp_init_global(&instance, &ODP_INIT_PARAMS, NULL);
+	if (rc != 0) {
+		printf("Error: odp_init_global() failed, rc = %d\n", rc);
+		abort();
+	}
+	rc = odp_init_local(instance, ODP_THREAD_CONTROL);
+	if (rc != 0) {
+		printf("Error: odp_init_local() failed, rc = %d\n", rc);
+		abort();
+	}
 
 	if (process_cmd_line_options(argc, argv) < 0)
 		return -1;