From f44982a7ca2c8fb636a75cd1fa70c9b4c1001e02 Mon Sep 17 00:00:00 2001 From: Serguei Sagalovitch Date: Fri, 22 Jan 2016 14:37:20 -0500 Subject: [PATCH] Fixed logic to return data back to user Change-Id: I324d07c38e8d7eb202d4dccfed6e62006cf9cd29 Signed-off-by: Serguei Sagalovitch --- tests/rdma/simple/app/rdma_test.cpp | 4 ++-- tests/rdma/simple/drv/amdp2ptest.c | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/rdma/simple/app/rdma_test.cpp b/tests/rdma/simple/app/rdma_test.cpp index 79aaf8ae33..211299fd10 100644 --- a/tests/rdma/simple/app/rdma_test.cpp +++ b/tests/rdma/simple/app/rdma_test.cpp @@ -130,7 +130,7 @@ void run_rdma_tests(HSAuint32 Node, HsaMemoryProperties *MemoryProperty) ret = ioctl(rdma_fd, AMD2P2PTEST_IOCTL_GET_PAGE_SIZE, &get_page_size); - if (ret < 0) + if (ret != 0) { fprintf(stderr, "AMD2P2PTEST_IOCTL_GET_PAGE_SIZE error (errno=%d/%s)\n", @@ -146,7 +146,7 @@ void run_rdma_tests(HSAuint32 Node, HsaMemoryProperties *MemoryProperty) ret = ioctl(rdma_fd, AMD2P2PTEST_IOCTL_GET_PAGES, &get_cpu_ptr); - if (ret < 0) + if (ret != 0) { fprintf(stderr, "AMD2P2PTEST_IOCTL_GET_PAGES error (errno=%d/%s)\n", ret, strerror(ret)); diff --git a/tests/rdma/simple/drv/amdp2ptest.c b/tests/rdma/simple/drv/amdp2ptest.c index 788185ae73..c504393c10 100644 --- a/tests/rdma/simple/drv/amdp2ptest.c +++ b/tests/rdma/simple/drv/amdp2ptest.c @@ -183,8 +183,7 @@ static int ioctl_get_page_size(struct file *filp, unsigned long arg) params.page_size = page_size; MSG_INFO("Page size %llx\n", params.page_size); - if (result && copy_to_user((void *)arg, ¶ms, - sizeof(params))) { + if (copy_to_user((void *)arg, ¶ms, sizeof(params))) { MSG_ERR("copy_to_user failed on user pointer %p\n", (void *)arg);