diff options
author | Sam Nelson <sam.nelson@ti.com> | 2018-02-15 17:05:07 -0500 |
---|---|---|
committer | Sam Nelson <sam.nelson@ti.com> | 2018-02-15 17:05:07 -0500 |
commit | b2f932fad4fbc63b047a7920863626ad2a93ebc8 (patch) | |
tree | 7fe8edf16075d98fab5c60549a0754e003fdf6ad | |
parent | 86462821d99cf0e5c4ad33158e08feeb01b26484 (diff) | |
download | linuxutils-b2f932fad4fbc63b047a7920863626ad2a93ebc8.tar.gz |
cmem: Bug fix: Correct return value checking
Need to check all negative values not only -1.
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
-rw-r--r-- | src/cmem/api/cmem.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cmem/api/cmem.c b/src/cmem/api/cmem.c index 838a199..40f1814 100644 --- a/src/cmem/api/cmem.c +++ b/src/cmem/api/cmem.c @@ -532,7 +532,7 @@ off64_t CMEM_getPhys64(void *ptr) } getDesc.virtp = ptr; - if (ioctl(cmem_fd, CMEM_IOCGETPHYS | CMEM_IOCMAGIC, &getDesc) == -1) { + if (ioctl(cmem_fd, CMEM_IOCGETPHYS | CMEM_IOCMAGIC, &getDesc) != 0) { __E("getPhys64: Failed to get physical address of %#x\n", (unsigned int)ptr); return 0; @@ -559,7 +559,7 @@ int CMEM_freePhys64(off64_t physp, CMEM_AllocParams *params) return -1; } - if (ioctl(cmem_fd, CMEM_IOCFREEPHYS | CMEM_IOCMAGIC, &physp) == -1) { + if (ioctl(cmem_fd, CMEM_IOCFREEPHYS | CMEM_IOCMAGIC, &physp) != 0) { __E("freePhys64: Failed to free buffer at physical address %#llx\n", (unsigned long long)physp); @@ -723,7 +723,7 @@ int CMEM_free(void *ptr, CMEM_AllocParams *params) freeDesc.virtp = ptr; cmd = CMEM_IOCFREE | params->type; - if (ioctl(cmem_fd, cmd | CMEM_IOCMAGIC, &freeDesc) == -1) { + if (ioctl(cmem_fd, cmd | CMEM_IOCMAGIC, &freeDesc) != 0) { __E("free: failed to free %#x\n", (unsigned int) ptr); return -1; } |