If event type is CL_COMMAND_USER, event->queue is NULL, cause segment fault.
Change the order to fix it.

Signed-off-by: Yang Rong <[email protected]>
---
 src/cl_api.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/cl_api.c b/src/cl_api.c
index f668ec6..2aca3f8 100644
--- a/src/cl_api.c
+++ b/src/cl_api.c
@@ -1228,8 +1228,8 @@ clGetEventProfilingInfo(cl_event             event,
 
   CHECK_EVENT(event);
 
-  if (!(event->queue->props & CL_QUEUE_PROFILING_ENABLE) ||
-          event->type == CL_COMMAND_USER ||
+  if (event->type == CL_COMMAND_USER ||
+      !(event->queue->props & CL_QUEUE_PROFILING_ENABLE) ||
           event->status != CL_COMPLETE) {
     err = CL_PROFILING_INFO_NOT_AVAILABLE;
     goto error;
-- 
1.8.1.2

_______________________________________________
Beignet mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/beignet

Reply via email to