Commit 1dcace30 authored by Thomas Wood's avatar Thomas Wood

build: fix unused-result warnings

Signed-off-by: default avatarThomas Wood <thomas.wood@intel.com>
parent f0381d1a
......@@ -41,6 +41,7 @@
#include <drm.h>
#include <xf86drm.h>
#include "drmtest.h"
#include "assert.h"
static double elapsed(const struct timespec *start,
const struct timespec *end,
......@@ -89,7 +90,7 @@ static void vblank_query(int fd, int busy)
printf("%f\n", 1e6/elapsed(&start, &end, count));
if (busy)
read(fd, &event, sizeof(event));
assert(read(fd, &event, sizeof(event)) != -1);
}
static void vblank_event(int fd, int busy)
......@@ -118,14 +119,14 @@ static void vblank_event(int fd, int busy)
vbl.request.sequence = 0;
drmIoctl(fd, DRM_IOCTL_WAIT_VBLANK, &vbl);
read(fd, &event, sizeof(event));
assert(read(fd, &event, sizeof(event)) != -1);
count++;
} while ((event.sequence - seq) <= 120);
clock_gettime(CLOCK_MONOTONIC, &end);
printf("%f\n", 1e6/elapsed(&start, &end, count));
if (busy)
read(fd, &event, sizeof(event));
assert(read(fd, &event, sizeof(event)) != -1);
}
int main(int argc, char **argv)
......
......@@ -147,7 +147,9 @@ dump_debug(void *buf, size_t count) {
if (!debug_fd)
debug_fd = open(debug_file, O_CREAT | O_WRONLY | O_TRUNC, S_IRWXO);
write(debug_fd, buf, count);
if (write(debug_fd, buf, count) == -1)
fprintf(stderr, "Error writing to debug file: %s\n",
strerror(errno));
}
static volatile void *
......
......@@ -767,8 +767,12 @@ static void igt_module_param_exit_handler(int sig)
fd = open(file_path, O_RDWR);
if (fd >= 0) {
write(fd, data->original_value,
strlen(data->original_value));
int size = strlen (data->original_value);
if (size != write(fd, data->original_value, size))
igt_warn("%s may not have been reset to its"
" original value\n", file_path);
close(fd);
}
}
......
......@@ -29,6 +29,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <assert.h>
#include "perf.h"
#include "igfx.h"
......@@ -260,7 +261,8 @@ static void mmio_init(struct gpu_top *gt)
mmio_ring_emit(&render_ring, 1000, payload);
mmio_ring_emit(&bsd_ring, 1000, payload);
mmio_ring_emit(&blt_ring, 1000, payload);
write(fd[1], payload, sizeof(payload));
assert(write(fd[1], payload, sizeof(payload))
== sizeof(payload));
}
}
......
......@@ -910,8 +910,8 @@ int main(int argc, char **argv)
if (daemonize && daemon(0, 0))
return EINVAL;
if (renice)
nice(renice);
if (renice && (nice(renice) == -1))
fprintf(stderr, "Could not renice: %s\n", strerror(errno));
signal(SIGUSR1, signal_snapshot);
......
......@@ -113,10 +113,10 @@ again:
udev_device_unref(udev_dev);
asprintf(&err_msg, "Parity error detected on: %d,%d,%d,%d. "
assert(asprintf(&err_msg, "Parity error detected on: %d,%d,%d,%d. "
"Try to run intel_l3_parity -r %d -b %d -s %d -w %d -d",
loc->slice, loc->row, loc->bank, loc->subbank,
loc->row, loc->bank, loc->subbank, loc->slice);
loc->row, loc->bank, loc->subbank, loc->slice) != -1);
if (daemon) {
syslog(LOG_INFO, "%s\n", err_msg);
goto again;
......
......@@ -506,7 +506,8 @@ static int intel_reg_snapshot(struct config *config, int argc, char *argv[])
intel_mmio_use_pci_bar(config->pci_dev);
/* XXX: error handling */
write(1, igt_global_mmio, config->pci_dev->regions[mmio_bar].size);
if (write(1, igt_global_mmio, config->pci_dev->regions[mmio_bar].size) == -1)
fprintf(stderr, "Error writing snapshot: %s", strerror(errno));
if (config->verbosity > 0)
printf("use this with --mmio=FILE --devid=0x%04X\n",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment