- /* wrong page count */
- if (rte_malloc_heap_memory_add(valid_name, addr, len,
- iova, 0, pgsz) >= 0 || rte_errno != EINVAL) {
- printf("%s():%i: Added memory with invalid parameters\n",
- __func__, __LINE__);
- goto fail;
- }
- if (rte_malloc_heap_memory_add(valid_name, addr, len,
- iova, n_pages - 1, pgsz) >= 0 || rte_errno != EINVAL) {
- printf("%s():%i: Added memory with invalid parameters\n",
- __func__, __LINE__);
- goto fail;
- }
- if (rte_malloc_heap_memory_add(valid_name, addr, len,
- iova, n_pages + 1, pgsz) >= 0 || rte_errno != EINVAL) {
- printf("%s():%i: Added memory with invalid parameters\n",
- __func__, __LINE__);
- goto fail;
+ /* the following tests are only valid if IOVA table is not NULL */
+ if (iova != NULL) {
+ /* wrong page count */
+ if (rte_malloc_heap_memory_add(valid_name, addr, len,
+ iova, 0, pgsz) >= 0 || rte_errno != EINVAL) {
+ printf("%s():%i: Added memory with invalid parameters\n",
+ __func__, __LINE__);
+ goto fail;
+ }
+ if (rte_malloc_heap_memory_add(valid_name, addr, len,
+ iova, n_pages - 1, pgsz) >= 0 ||
+ rte_errno != EINVAL) {
+ printf("%s():%i: Added memory with invalid parameters\n",
+ __func__, __LINE__);
+ goto fail;
+ }
+ if (rte_malloc_heap_memory_add(valid_name, addr, len,
+ iova, n_pages + 1, pgsz) >= 0 ||
+ rte_errno != EINVAL) {
+ printf("%s():%i: Added memory with invalid parameters\n",
+ __func__, __LINE__);
+ goto fail;
+ }