intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH i-g-t] lib/igt_core: Handle glib errors correctly to avoid stderr spew
@ 2017-07-20  7:45 Paul Kocialkowski
  2017-07-20  7:47 ` Paul Kocialkowski
  2017-07-20  8:07 ` [PATCH i-g-t v2] " Paul Kocialkowski
  0 siblings, 2 replies; 4+ messages in thread
From: Paul Kocialkowski @ 2017-07-20  7:45 UTC (permalink / raw)
  To: intel-gfx; +Cc: Daniel Vetter

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH i-g-t] lib/igt_core: Handle glib errors correctly to avoid stderr spew
  2017-07-20  7:45 [PATCH i-g-t] lib/igt_core: Handle glib errors correctly to avoid stderr spew Paul Kocialkowski
@ 2017-07-20  7:47 ` Paul Kocialkowski
  2017-07-20  8:07 ` [PATCH i-g-t v2] " Paul Kocialkowski
  1 sibling, 0 replies; 4+ messages in thread
From: Paul Kocialkowski @ 2017-07-20  7:47 UTC (permalink / raw)
  To: intel-gfx; +Cc: Daniel Vetter

On Thu, 2017-07-20 at 10:45 +0300, Paul Kocialkowski wrote:
> 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.

Fixes: ee31e0b5 ("Introduce common frame dumping configuration...")

> 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)
>  							"FrameDumpPat
> h",
>  							&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
>  
-- 
Paul Kocialkowski <paul.kocialkowski@linux.intel.com>
Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo, Finland
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH i-g-t v2] lib/igt_core: Handle glib errors correctly to avoid stderr spew
  2017-07-20  7:45 [PATCH i-g-t] lib/igt_core: Handle glib errors correctly to avoid stderr spew Paul Kocialkowski
  2017-07-20  7:47 ` Paul Kocialkowski
@ 2017-07-20  8:07 ` Paul Kocialkowski
  2017-07-20  8:14   ` Arkadiusz Hiler
  1 sibling, 1 reply; 4+ messages in thread
From: Paul Kocialkowski @ 2017-07-20  8:07 UTC (permalink / raw)
  To: intel-gfx; +Cc: Daniel Vetter

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 with this message:

    GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory.
    This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
    The overwriting error message was: Key file does not have group ?DUT?

Fixes: ee31e0b5 ("Introduce common frame dumping configuration...")

Cc: Paul Kocialkowski <paul.kocialkowski@linux.intel.com>
Cc: Lyude <lyude@redhat.com>
Cc: Martin Peres <martin.peres@linux.intel.com>
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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH i-g-t v2] lib/igt_core: Handle glib errors correctly to avoid stderr spew
  2017-07-20  8:07 ` [PATCH i-g-t v2] " Paul Kocialkowski
@ 2017-07-20  8:14   ` Arkadiusz Hiler
  0 siblings, 0 replies; 4+ messages in thread
From: Arkadiusz Hiler @ 2017-07-20  8:14 UTC (permalink / raw)
  To: Paul Kocialkowski; +Cc: Daniel Vetter, intel-gfx

On Thu, Jul 20, 2017 at 11:07:42AM +0300, Paul Kocialkowski wrote:
> 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 with this message:
> 
>     GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory.
>     This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
>     The overwriting error message was: Key file does not have group ?DUT?
> 
> Fixes: ee31e0b5 ("Introduce common frame dumping configuration...")
> 
> Cc: Paul Kocialkowski <paul.kocialkowski@linux.intel.com>
> Cc: Lyude <lyude@redhat.com>
> Cc: Martin Peres <martin.peres@linux.intel.com>
> Signed-off-by: Paul Kocialkowski <paul.kocialkowski@linux.intel.com>
Acked-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>

and pushed.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-07-20  8:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-20  7:45 [PATCH i-g-t] lib/igt_core: Handle glib errors correctly to avoid stderr spew Paul Kocialkowski
2017-07-20  7:47 ` Paul Kocialkowski
2017-07-20  8:07 ` [PATCH i-g-t v2] " Paul Kocialkowski
2017-07-20  8:14   ` Arkadiusz Hiler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).