]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
drm/i915: Fix regression in 95ca9d
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 20 Feb 2009 17:52:20 +0000 (17:52 +0000)
committerDave Airlie <airlied@redhat.com>
Mon, 23 Feb 2009 00:06:30 +0000 (10:06 +1000)
The object is dereferenced before the NULL check. Oops.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=20235

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/i915/i915_gem.c

index 8b50d48203891f40e64ffd0cfa553e19ce98767d..25b337438ca737d4148bbc473f68483ece0d40bc 100644 (file)
@@ -3143,16 +3143,20 @@ static void
 i915_gem_cleanup_hws(struct drm_device *dev)
 {
        drm_i915_private_t *dev_priv = dev->dev_private;
-       struct drm_gem_object *obj = dev_priv->hws_obj;
-       struct drm_i915_gem_object *obj_priv = obj->driver_private;
+       struct drm_gem_object *obj;
+       struct drm_i915_gem_object *obj_priv;
 
        if (dev_priv->hws_obj == NULL)
                return;
 
+       obj = dev_priv->hws_obj;
+       obj_priv = obj->driver_private;
+
        kunmap(obj_priv->page_list[0]);
        i915_gem_object_unpin(obj);
        drm_gem_object_unreference(obj);
        dev_priv->hws_obj = NULL;
+
        memset(&dev_priv->hws_map, 0, sizeof(dev_priv->hws_map));
        dev_priv->hw_status_page = NULL;