drm/i915: Unref the object after failing to set tiling mode.
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 30 Jan 2009 21:10:22 +0000 (21:10 +0000)
committerDave Airlie <airlied@linux.ie>
Sun, 8 Feb 2009 11:38:08 +0000 (21:38 +1000)
Cleanup the object reference on the error paths.

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

index 2534c792808e3aa20b3782e44a1e1c3154a04644..fa1685cba8402fdbd456be37f627bd21c170cca4 100644 (file)
@@ -258,8 +258,10 @@ i915_gem_set_tiling(struct drm_device *dev, void *data,
                return -EINVAL;
        obj_priv = obj->driver_private;
 
-       if (!i915_tiling_ok(dev, args->stride, obj->size, args->tiling_mode))
+       if (!i915_tiling_ok(dev, args->stride, obj->size, args->tiling_mode)) {
+               drm_gem_object_unreference(obj);
                return -EINVAL;
+       }
 
        mutex_lock(&dev->struct_mutex);
 
@@ -289,6 +291,7 @@ i915_gem_set_tiling(struct drm_device *dev, void *data,
                             "failed to unbind object for tiling switch");
                        args->tiling_mode = obj_priv->tiling_mode;
                        mutex_unlock(&dev->struct_mutex);
+                       drm_gem_object_unreference(obj);
 
                        return ret;
                }