Skip to content

Commit

Permalink
drm/i915: Unref the object after failing to set tiling mode.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Chris Wilson authored and Dave Airlie committed Feb 8, 2009
1 parent 0f973f2 commit 72daad4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/gpu/drm/i915/i915_gem_tiling.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 72daad4

Please sign in to comment.