driver: fix a potential Null reference.
authorZhigang Gong <zhigang.gong@intel.com>
Tue, 17 Jun 2014 03:16:55 +0000 (11:16 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Tue, 17 Jun 2014 09:06:55 +0000 (17:06 +0800)
cl_gpgpu_flush may be called when the batch buffer has been
released. We need to check whether there is a valid buffer
before we really take the following actions.

Signed-off-by: Zhigang Gong <zhigang.gong@intel.com>
Reviewed-by: He Junyan <junyan.he@inbox.com>
src/intel/intel_gpgpu.c

index 1da6400..6af6e40 100644 (file)
@@ -555,6 +555,8 @@ intel_gpgpu_check_binded_buf_address(intel_gpgpu_t *gpgpu)
 static void
 intel_gpgpu_flush(intel_gpgpu_t *gpgpu)
 {
+  if (!gpgpu->batch || !gpgpu->batch->buffer)
+    return;
   intel_batchbuffer_emit_mi_flush(gpgpu->batch);
   intel_batchbuffer_flush(gpgpu->batch);
   intel_gpgpu_check_binded_buf_address(gpgpu);