All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Kocialkowski <paul.kocialkowski@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@intel.com>
Subject: [PATCH i-g-t] lib/igt_core: Handle glib errors correctly to avoid stderr spew
Date: Thu, 20 Jul 2017 10:45:52 +0300	[thread overview]
Message-ID: <20170720074552.4279-1-paul.kocialkowski@linux.intel.com> (raw)

This adds the required error clean/free calls after calling
configuration parsing functions. In addition to properly handling memory,
this avoids glib spewing out error messages on stderr, which breaks the
whole CI.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@linux.intel.com>
---
 lib/igt_core.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 028ef6bd..03d9a5bf 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -637,10 +637,16 @@ static int config_parse(void)
 							"FrameDumpPath",
 							&error);
 
+	g_clear_error(&error);
+
 	rc = g_key_file_get_integer(igt_key_file, "DUT", "SuspendResumeDelay",
 				    &error);
-	if (error && error->code == G_KEY_FILE_ERROR_INVALID_VALUE)
+	if (error && error->code == G_KEY_FILE_ERROR_INVALID_VALUE) {
+		g_error_free(error);
 		return -2;
+	}
+
+	g_clear_error(&error);
 
 	if (rc != 0)
 		igt_set_autoresume_delay(rc);
@@ -809,6 +815,7 @@ static int common_init(int *argc, char **argv,
 	ret = g_key_file_load_from_file(igt_key_file, key_file_loc,
 					G_KEY_FILE_NONE, &error);
 	if (error && error->code == G_KEY_FILE_ERROR) {
+		g_error_free(error);
 		g_key_file_free(igt_key_file);
 		igt_key_file = NULL;
 		ret = -2;
@@ -816,6 +823,8 @@ static int common_init(int *argc, char **argv,
 		goto out;
 	}
 
+	g_clear_error(&error);
+
 	ret = config_parse();
 #endif
 
-- 
2.13.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

             reply	other threads:[~2017-07-20  7:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-20  7:45 Paul Kocialkowski [this message]
2017-07-20  7:47 ` [PATCH i-g-t] lib/igt_core: Handle glib errors correctly to avoid stderr spew Paul Kocialkowski
2017-07-20  8:07 ` [PATCH i-g-t v2] " Paul Kocialkowski
2017-07-20  8:14   ` Arkadiusz Hiler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170720074552.4279-1-paul.kocialkowski@linux.intel.com \
    --to=paul.kocialkowski@linux.intel.com \
    --cc=daniel.vetter@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.