Commit 72daad40 authored by Chris Wilson's avatar Chris Wilson Committed by Dave Airlie

drm/i915: Unref the object after failing to set tiling mode.

Cleanup the object reference on the error paths.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarEric Anholt <eric@anholt.net>
Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
parent 0f973f27
...@@ -258,8 +258,10 @@ i915_gem_set_tiling(struct drm_device *dev, void *data, ...@@ -258,8 +258,10 @@ i915_gem_set_tiling(struct drm_device *dev, void *data,
return -EINVAL; return -EINVAL;
obj_priv = obj->driver_private; 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; return -EINVAL;
}
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
...@@ -289,6 +291,7 @@ i915_gem_set_tiling(struct drm_device *dev, void *data, ...@@ -289,6 +291,7 @@ i915_gem_set_tiling(struct drm_device *dev, void *data,
"failed to unbind object for tiling switch"); "failed to unbind object for tiling switch");
args->tiling_mode = obj_priv->tiling_mode; args->tiling_mode = obj_priv->tiling_mode;
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
drm_gem_object_unreference(obj);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment