allocating request. Though, it's unlikely cause if request is NULL
then BUG_ON will be hit in i915_add_request(). So, to unify the callee
uses of i915_add_request(), I'm proposing the following patch. Please
let me know what do you guys think. If you guys agree, I can sent a
formal patch.

Index: work/modi.linux-3.1.1/drivers/gpu/drm/i915/i915_gem.c
===================================================================
--- work.orig/modi.linux-3.1.1/drivers/gpu/drm/i915/i915_gem.c
+++ work/modi.linux-3.1.1/drivers/gpu/drm/i915/i915_gem.c
@@ -1736,8 +1736,6 @@ i915_add_request(struct intel_ring_buffe
        int was_empty;
        int ret;

-       BUG_ON(request == NULL);
-
        ret = ring->add_request(ring, &seqno);
        if (ret)
            return ret;
@@ -2002,9 +2000,11 @@ i915_gem_retire_work_handler(struct work
                        ret = i915_gem_flush_ring(ring,
                                                  0, I915_GEM_GPU_DOMAINS);
                        request = kzalloc(sizeof(*request), GFP_KERNEL);
-                       if (ret || request == NULL ||
-                           i915_add_request(ring, NULL, request))
-                           kfree(request);
+                       if (request) {
+                               ret = i915_add_request(ring, NULL, request);
+                               if (ret)
+                                       kfree(request);
+                       }
                }

                idle &= list_empty(&ring->request_list);


Thanks,
Rakib

Reply via email to