Fix a event segment fault.
authorYang Rong <rong.r.yang@intel.com>
Tue, 29 Oct 2013 05:39:35 +0000 (13:39 +0800)
committerZhigang Gong <zhigang.gong@linux.intel.com>
Tue, 29 Oct 2013 05:40:26 +0000 (13:40 +0800)
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 <rong.r.yang@intel.com>
Reviewed-by: "Xing, Homer" <homer.xing@intel.com>
src/cl_api.c

index 173810b..70a8d09 100644 (file)
@@ -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;