From patchwork Mon Sep 7 11:34:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Wood X-Patchwork-Id: 7134021 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3146D9F54C for ; Mon, 7 Sep 2015 11:43:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 240DA20620 for ; Mon, 7 Sep 2015 11:43:31 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 0F3A220639 for ; Mon, 7 Sep 2015 11:43:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 480336E2EC; Mon, 7 Sep 2015 04:43:28 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id 47EEE89CA2 for ; Mon, 7 Sep 2015 04:43:26 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 07 Sep 2015 04:43:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,484,1437462000"; d="scan'208";a="799400982" Received: from otc-vmt1.isw.intel.com ([10.237.224.80]) by orsmga002.jf.intel.com with ESMTP; 07 Sep 2015 04:43:24 -0700 From: Thomas Wood To: intel-gfx@lists.freedesktop.org Date: Mon, 7 Sep 2015 12:34:11 +0100 Message-Id: <1441625652-5233-1-git-send-email-thomas.wood@intel.com> X-Mailer: git-send-email 1.9.1 Organization: Intel Corporation (UK) Ltd. - Co. Reg. #1134945 - Pipers Way, Swindon SN3 1RJ Subject: [Intel-gfx] [PATCH i-g-t 1/2] build: fix unused-result warnings X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Thomas Wood --- benchmarks/kms_vblank.c | 7 ++++--- debugger/eudb.c | 4 +++- lib/igt_aux.c | 8 ++++++-- overlay/gpu-top.c | 4 +++- overlay/overlay.c | 4 ++-- tools/intel_l3_udev_listener.c | 4 ++-- tools/intel_reg.c | 3 ++- 7 files changed, 22 insertions(+), 12 deletions(-) diff --git a/benchmarks/kms_vblank.c b/benchmarks/kms_vblank.c index f9dbe3d..3d2f977 100644 --- a/benchmarks/kms_vblank.c +++ b/benchmarks/kms_vblank.c @@ -41,6 +41,7 @@ #include #include #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) diff --git a/debugger/eudb.c b/debugger/eudb.c index 39c5cca..275a27e 100644 --- a/debugger/eudb.c +++ b/debugger/eudb.c @@ -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 * diff --git a/lib/igt_aux.c b/lib/igt_aux.c index c26d167..e77392c 100644 --- a/lib/igt_aux.c +++ b/lib/igt_aux.c @@ -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); } } diff --git a/overlay/gpu-top.c b/overlay/gpu-top.c index d1f5ec8..4097cd0 100644 --- a/overlay/gpu-top.c +++ b/overlay/gpu-top.c @@ -29,6 +29,7 @@ #include #include #include +#include #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)); } } diff --git a/overlay/overlay.c b/overlay/overlay.c index 035e02c..3c0dbb4 100644 --- a/overlay/overlay.c +++ b/overlay/overlay.c @@ -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); diff --git a/tools/intel_l3_udev_listener.c b/tools/intel_l3_udev_listener.c index 261630e..0b94c1c 100644 --- a/tools/intel_l3_udev_listener.c +++ b/tools/intel_l3_udev_listener.c @@ -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; diff --git a/tools/intel_reg.c b/tools/intel_reg.c index 95760db..bef3287 100644 --- a/tools/intel_reg.c +++ b/tools/intel_reg.c @@ -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",