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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Damien Lespiau <damien.lespiau@xxxxxxxxx>
---
 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

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





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux