summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2018-05-02 15:54:32 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2020-09-03 13:52:05 +0100
commite6824aba29c2d4a8f88e617cd1e4222a80ec837f (patch)
treedcf56cbb26bbcde5db7baedfd406a1c122c7bd66
parenta00f04c3235d312169fb2f39e35c1e5317262122 (diff)
lib: Clear errno when reporting err
Fix a few ioctl wrappers that were reporting back the errno through the conventional return parameter, but left errno set. Leaving it set causes confusion when the stale value gets printed by later asserts. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--lib/ioctl_wrappers.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 3781286d..33f9f023 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -337,6 +337,8 @@ int __gem_write(int fd, uint32_t handle, uint64_t offset, const void *buf, uint6
err = 0;
if (drmIoctl(fd, DRM_IOCTL_I915_GEM_PWRITE, &gem_pwrite))
err = -errno;
+
+ errno = 0;
return err;
}
@@ -370,6 +372,8 @@ int __gem_read(int fd, uint32_t handle, uint64_t offset, void *buf, uint64_t len
err = 0;
if (drmIoctl(fd, DRM_IOCTL_I915_GEM_PREAD, &gem_pread))
err = -errno;
+
+ errno = 0;
return err;
}
/**
@@ -402,6 +406,7 @@ int __gem_set_domain(int fd, uint32_t handle, uint32_t read, uint32_t write)
if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, &set_domain))
err = -errno;
+ errno = 0;
return err;
}
@@ -450,6 +455,7 @@ int gem_wait(int fd, uint32_t handle, int64_t *timeout_ns)
if (timeout_ns)
*timeout_ns = wait.timeout_ns;
+ errno = 0;
return ret;
}