drm: Remove two leaks of vblank reference count in error paths.
authorEric Anholt <eric@anholt.net>
Fri, 17 Oct 2008 18:03:53 +0000 (11:03 -0700)
committerDave Airlie <airlied@redhat.com>
Thu, 23 Oct 2008 03:42:27 +0000 (13:42 +1000)
If the failing paths were hit, the vblank IRQ would never get turned off
again.

Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_irq.c
drivers/gpu/drm/i915/i915_irq.c

index 4091b9e291f918be5f23a8391b48aa391d498f9c..212a94f715b23cf2db6103a301c91f9c6545a4ce 100644 (file)
@@ -594,11 +594,14 @@ int drm_wait_vblank(struct drm_device *dev, void *data,
                        goto done;
                }
 
+               /* Get a refcount on the vblank, which will be released by
+                * drm_vbl_send_signals().
+                */
                ret = drm_vblank_get(dev, crtc);
                if (ret) {
                        drm_free(vbl_sig, sizeof(struct drm_vbl_sig),
                                 DRM_MEM_DRIVER);
-                       return ret;
+                       goto done;
                }
 
                atomic_inc(&dev->vbl_signal_pending);
index 671dd79d0aac5aa704652235522166843b69892c..2cd853b2c5629fb133f968bf28e64e633432242a 100644 (file)
@@ -771,6 +771,7 @@ int i915_vblank_swap(struct drm_device *dev, void *data,
                    vbl_swap->plane == plane &&
                    vbl_swap->sequence == swap->sequence) {
                        spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags);
+                       drm_vblank_put(dev, pipe);
                        DRM_DEBUG("Already scheduled\n");
                        return 0;
                }