From: Elena Agostini <eagost...@nvidia.com> Signed-off-by: Elena Agostini <eagost...@nvidia.com> --- drivers/gpu/cuda/cuda.c | 4 ++-- lib/gpudev/gpudev.c | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/cuda/cuda.c b/drivers/gpu/cuda/cuda.c index 24ae630d04..f68e2b20b9 100644 --- a/drivers/gpu/cuda/cuda.c +++ b/drivers/gpu/cuda/cuda.c @@ -765,7 +765,7 @@ cuda_mem_free(struct rte_gpu *dev, void *ptr) return -ENODEV; if (ptr == NULL) - return -EINVAL; + return 0; hk = get_hash_from_ptr((void *)ptr); @@ -804,7 +804,7 @@ cuda_mem_unregister(struct rte_gpu *dev, void *ptr) return -ENODEV; if (ptr == NULL) - return -EINVAL; + return 0; hk = get_hash_from_ptr((void *)ptr); diff --git a/lib/gpudev/gpudev.c b/lib/gpudev/gpudev.c index 2b174d8bd5..b41c43016a 100644 --- a/lib/gpudev/gpudev.c +++ b/lib/gpudev/gpudev.c @@ -569,6 +569,9 @@ rte_gpu_mem_free(int16_t dev_id, void *ptr) { struct rte_gpu *dev; + if (ptr == NULL) + return 0; + dev = gpu_get_by_id(dev_id); if (dev == NULL) { GPU_LOG(ERR, "free mem for invalid device ID %d", dev_id); @@ -612,6 +615,9 @@ rte_gpu_mem_unregister(int16_t dev_id, void *ptr) { struct rte_gpu *dev; + if (ptr == NULL) + return 0; + dev = gpu_get_by_id(dev_id); if (dev == NULL) { GPU_LOG(ERR, "unregister mem for invalid device ID %d", dev_id); -- 2.17.1