diff mbox series

[v1,2/3] linux-gen: pktio test odp_shm_reserve return code

Message ID 1508338806-1394-3-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [v1,1/3] linux-gen: pktio: add missing unlock | expand

Commit Message

Github ODP bot Oct. 18, 2017, 3 p.m. UTC
From: Maxim Uvarov <maxim.uvarov@linaro.org>


Better to check odp_shm_reserve() code than address.

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

---
/** Email created from pull request 239 (muvarov:master_bug3242)
 ** https://github.com/Linaro/odp/pull/239
 ** Patch: https://github.com/Linaro/odp/pull/239.patch
 ** Base sha: ec0c3145fcafa09ae3a79875e7e07dd4794583cc
 ** Merge commit sha: 13cc3007dc36c8942ffe7dd834f3812b32ae2ae3
 **/
 platform/linux-generic/odp_packet_io.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c
index c2e6742b2..4363711fb 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -59,11 +59,10 @@  int odp_pktio_init_global(void)
 	shm = odp_shm_reserve("odp_pktio_entries",
 			      sizeof(pktio_table_t),
 			      sizeof(pktio_entry_t), 0);
-	pktio_tbl = odp_shm_addr(shm);
-
-	if (pktio_tbl == NULL)
+	if (shm == ODP_SHM_INVALID)
 		return -1;
 
+	pktio_tbl = odp_shm_addr(shm);
 	memset(pktio_tbl, 0, sizeof(pktio_table_t));
 
 	odp_spinlock_init(&pktio_tbl->lock);