From patchwork Wed Oct 15 11:43:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kuoppala X-Patchwork-Id: 5085301 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B9EFCC11AC for ; Wed, 15 Oct 2014 11:41:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BBF6D2010B for ; Wed, 15 Oct 2014 11:41:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B932E200E8 for ; Wed, 15 Oct 2014 11:41:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B7E18898C0; Wed, 15 Oct 2014 04:41:50 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id DAECA898C0 for ; Wed, 15 Oct 2014 04:41:49 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 15 Oct 2014 04:41:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,723,1406617200"; d="scan'208";a="589348651" Received: from rosetta.fi.intel.com (HELO rosetta) ([10.237.72.93]) by orsmga001.jf.intel.com with ESMTP; 15 Oct 2014 04:41:48 -0700 Received: by rosetta (Postfix, from userid 1000) id A75B680052; Wed, 15 Oct 2014 14:43:36 +0300 (EEST) From: Mika Kuoppala To: intel-gfx@lists.freedesktop.org Date: Wed, 15 Oct 2014 14:43:35 +0300 Message-Id: <1413373415-30425-1-git-send-email-mika.kuoppala@intel.com> X-Mailer: git-send-email 1.9.1 Subject: [Intel-gfx] [PATCH] lib: fix warnings on ignoring return values X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 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: Mika Kuoppala --- lib/igt_core.c | 21 ++++++++++++++++----- lib/igt_debugfs.c | 6 +++--- lib/igt_kms.c | 22 +++++++++++++--------- lib/intel_os.c | 2 +- 4 files changed, 33 insertions(+), 18 deletions(-) diff --git a/lib/igt_core.c b/lib/igt_core.c index e3d5fb0..287e345 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -336,13 +336,18 @@ static void low_mem_killer_disable(bool disable) /* writing 9999 to this module parameter effectively diables the * low memory killer. This is not a real file, so we dont need to * seek to the start or truncate it */ - write(fd, no_lowmem_killer, sizeof(no_lowmem_killer)); + igt_assert( + write(fd, no_lowmem_killer, sizeof(no_lowmem_killer)) + == sizeof(no_lowmem_killer)); close(fd); } else { /* just re-enstate the original settings */ fd = open(adj_fname, O_WRONLY); igt_assert(fd != -1); - write(fd, prev_adj_scores, adj_scores_len); + igt_assert( + write(fd, prev_adj_scores, adj_scores_len) + == adj_scores_len); + close(fd); } @@ -775,7 +780,10 @@ void __igt_skip_check(const char *file, const int line, char *err_str = NULL; if (err) - asprintf(&err_str, "Last errno: %i, %s\n", err, strerror(err)); + igt_assert( + asprintf(&err_str, "Last errno: %i, %s\n", + err, strerror(err)) + > 0); if (f) { static char *buf; @@ -785,7 +793,7 @@ void __igt_skip_check(const char *file, const int line, free(buf); va_start(args, f); - vasprintf(&buf, f, args); + igt_assert(vasprintf(&buf, f, args) >= 0); va_end(args); igt_skip("Test requirement not met in function %s, file %s:%i:\n" @@ -878,7 +886,10 @@ void __igt_fail_assert(int exitcode, const char *file, char *err_str = NULL; if (err) - asprintf(&err_str, "Last errno: %i, %s\n", err, strerror(err)); + igt_assert( + asprintf(&err_str, "Last errno: %i, %s\n", + err, strerror(err)) + > 0); printf("Test assertion failure function %s, file %s:%i:\n" "Failed assertion: %s\n" diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c index b30f5e4..f4ff61a 100644 --- a/lib/igt_debugfs.c +++ b/lib/igt_debugfs.c @@ -297,7 +297,7 @@ static bool igt_pipe_crc_do_start(igt_pipe_crc_t *pipe_crc) sprintf(buf, "pipe %s %s", kmstest_pipe_name(pipe_crc->pipe), pipe_crc_source_name(pipe_crc->source)); errno = 0; - write(pipe_crc->ctl_fd, buf, strlen(buf)); + igt_assert(write(pipe_crc->ctl_fd, buf, strlen(buf)) == strlen(buf)); if (errno != 0) return false; @@ -309,7 +309,7 @@ static void igt_pipe_crc_pipe_off(int fd, enum pipe pipe) char buf[32]; sprintf(buf, "pipe %s none", kmstest_pipe_name(pipe)); - write(fd, buf, strlen(buf)); + igt_assert(write(fd, buf, strlen(buf) == strlen(buf))); } static void igt_pipe_crc_reset(void) @@ -446,7 +446,7 @@ void igt_pipe_crc_stop(igt_pipe_crc_t *pipe_crc) char buf[32]; sprintf(buf, "pipe %s none", kmstest_pipe_name(pipe_crc->pipe)); - write(pipe_crc->ctl_fd, buf, strlen(buf)); + igt_assert(write(pipe_crc->ctl_fd, buf, strlen(buf)) == strlen(buf)); } static bool pipe_crc_init_from_string(igt_crc_t *crc, const char *line) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 0547147..49bc6a9 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -323,11 +323,13 @@ static char* get_debugfs_connector_path(int drm_fd, drmModeConnector *connector, { char *path; - asprintf(&path, "/sys/kernel/debug/dri/%d/%s-%d/%s", - get_card_number(drm_fd), - kmstest_connector_type_str(connector->connector_type), - connector->connector_type_id, - file); + igt_assert( + asprintf(&path, "/sys/kernel/debug/dri/%d/%s-%d/%s", + get_card_number(drm_fd), + kmstest_connector_type_str(connector->connector_type), + connector->connector_type_id, + file) + > 0); return path; } @@ -851,9 +853,11 @@ static void igt_output_refresh(igt_output_t *output) if (!output->name) { drmModeConnector *c = output->config.connector; - asprintf(&output->name, "%s-%d", - kmstest_connector_type_str(c->connector_type), - c->connector_type_id); + igt_assert( + asprintf(&output->name, "%s-%d", + kmstest_connector_type_str(c->connector_type), + c->connector_type_id) + > 0); } LOG(display, "%s: Selecting pipe %s\n", output->name, @@ -1795,7 +1799,7 @@ void igt_reset_connectors(void) for (tmp = forced_connectors; *tmp; tmp++) { int fd = open(*tmp, O_WRONLY | O_TRUNC); - write(fd, "unspecified", 11); + igt_assert(write(fd, "unspecified", 11) == 11); close(fd); } } diff --git a/lib/intel_os.c b/lib/intel_os.c index c8793b9..c05e4b8 100644 --- a/lib/intel_os.c +++ b/lib/intel_os.c @@ -257,7 +257,7 @@ intel_purge_vm_caches(void) if (fd < 0) return; - write(fd, "3\n", 2); + igt_assert(write(fd, "3\n", 2) == 2); close(fd); }