tests/gem_exec_blt: silence the compiler by failing on error

gem_exec_blt.c: In function ‘gem_exec’:
gem_exec_blt.c:174:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]

Propagate the failure and exit(1).
This commit is contained in:
Chris Wilson 2011-12-14 17:41:34 +00:00
parent 2a292188e7
commit f381a8b9f0

View File

@ -169,15 +169,17 @@ static void gem_sync(int fd, uint32_t handle)
drmIoctl(fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, &set_domain);
}
static void gem_exec(int fd, struct drm_i915_gem_execbuffer2 *execbuf, int loops)
static int gem_exec(int fd, struct drm_i915_gem_execbuffer2 *execbuf, int loops)
{
int ret;
int ret = 0;
while (loops--) {
while (loops-- && ret == 0) {
ret = drmIoctl(fd,
DRM_IOCTL_I915_GEM_EXECBUFFER2,
execbuf);
}
return ret;
}
static double elapsed(const struct timeval *start,
@ -272,7 +274,8 @@ static void run(int object_size)
struct timeval start, end;
gettimeofday(&start, NULL);
gem_exec(fd, &execbuf, count);
if (gem_exec(fd, &execbuf, count))
exit(1);
gem_sync(fd, handle);
gettimeofday(&end, NULL);
printf("Time to blt %d bytes x %6d: %7.3fµs, %s\n",