diff mbox

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

Message ID 1425572420-10067-11-git-send-email-damien.lespiau@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lespiau, Damien March 5, 2015, 4:20 p.m. UTC
If, for some reason, we couldn't create the decode context, exit,
instead of segfaulting.

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

Patch

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)