i915g: Handle i915->batch == NULL correctly in flush
authorStéphane Marchesin <marcheu@chromium.org>
Fri, 6 Sep 2013 17:55:16 +0000 (10:55 -0700)
committerStéphane Marchesin <marcheu@chromium.org>
Fri, 6 Sep 2013 18:05:24 +0000 (11:05 -0700)
Fixes warning reported by Coverity.

src/gallium/drivers/i915/i915_flush.c

index 0dca722d63659940833cfded681d909a6e33329a..8cc31a8e0c46d57387d84aa2dab3388f324efc08 100644 (file)
@@ -45,10 +45,13 @@ static void i915_flush_pipe( struct pipe_context *pipe,
    struct i915_context *i915 = i915_context(pipe);
    enum i915_winsys_flush_flags winsys_flags = I915_FLUSH_ASYNC;
 
+   if (!i915->batch)
+      return;
+
    /* Only shortcut this if we have no fence, otherwise we must flush the
     * empty batchbuffer to get our fence back.
     */
-   if (!fence && i915->batch && (i915->batch->map == i915->batch->ptr)) {
+   if (!fence && (i915->batch->map == i915->batch->ptr)) {
       return;
    }