[Intel-gfx] [PATCH 10/12] intel: Make test_decode fail gracefully the decode context is NULL

Damien Lespiau damien.lespiau at intel.com
Thu Mar 5 08:20:18 PST 2015


If, for some reason, we couldn't create the decode context, exit,
instead of segfaulting.

Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
---
 intel/test_decode.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/intel/test_decode.c b/intel/test_decode.c
index 93f47ef..1ffd829 100644
--- a/intel/test_decode.c
+++ b/intel/test_decode.c
@@ -182,6 +182,11 @@ main(int argc, char **argv)
 	devid = infer_devid(argv[1]);
 
 	ctx = drm_intel_decode_context_alloc(devid);
+	if (!ctx) {
+		fprintf(stderr, "Couldn't create decode context for 0x%04x\n",
+			devid);
+		exit(1);
+	}
 
 	if (argc == 3) {
 		if (strcmp(argv[2], "-dump") == 0)
-- 
1.8.3.1



More information about the Intel-gfx mailing list