From: Maxim Uvarov <maxim.uva...@linaro.org>

Better to check odp_shm_reserve() code than address.

Signed-off-by: Maxim Uvarov <maxim.uva...@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 --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);

Reply via email to