Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/3] lib/igt_chamelium: Sanitize the init error and deinit path
@ 2020-07-07 13:18 Imre Deak
  2020-07-07  8:19 ` Kunal Joshi
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Imre Deak @ 2020-07-07 13:18 UTC (permalink / raw)
  To: igt-dev; +Cc: Kunal Joshi

Always return NULL from init in case of an error, and reuse
chamelium_deinit_rpc_only() for symmetry with init, instead of
open-coding the same.

Cc: Lyude Paul <lyude@redhat.com>
Cc: Kunal Joshi <kunal1.joshi@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 lib/igt_chamelium.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index 58e01ab72..5924e5615 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -2512,7 +2512,8 @@ struct chamelium *chamelium_init(int drm_fd)
 	return chamelium;
 error:
 	chamelium_deinit_rpc_only(chamelium);
-	return chamelium;
+
+	return NULL;
 }
 
 /**
@@ -2550,12 +2551,11 @@ void chamelium_deinit(struct chamelium *chamelium)
 	}
 
 	xmlrpc_client_destroy(chamelium->client);
-	xmlrpc_env_clean(&chamelium->env);
 
 	for (i = 0; i < chamelium->port_count; i++)
 		free(chamelium->ports[i].name);
 
-	free(chamelium);
+	chamelium_deinit_rpc_only(chamelium);
 }
 
 bool chamelium_plug_all(struct chamelium *chamelium)
-- 
2.23.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

end of thread, other threads:[~2020-07-08 11:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-07 13:18 [igt-dev] [PATCH i-g-t 1/3] lib/igt_chamelium: Sanitize the init error and deinit path Imre Deak
2020-07-07  8:19 ` Kunal Joshi
2020-07-07 13:18 ` [igt-dev] [PATCH i-g-t 2/3] lib/igt_chamelium: Duplicate the caller's drm_fd Imre Deak
2020-07-07 13:18 ` [igt-dev] [PATCH i-g-t 3/3] lib/igt_chamelium: Wait for connectors after replugging them at exit Imre Deak
2020-07-07 13:41 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] lib/igt_chamelium: Sanitize the init error and deinit path Patchwork
2020-07-08 10:08   ` Imre Deak
2020-07-08 11:53     ` Vudum, Lakshminarayana
2020-07-07 16:02 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2020-07-08 10:54 ` [igt-dev] ✓ Fi.CI.IGT: success " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox