diff options
author | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2016-11-02 15:14:59 +0000 |
---|---|---|
committer | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2016-11-03 13:52:57 +0000 |
commit | a933568eb61d6c0b12af4264ae1ba316447a2189 (patch) | |
tree | 3b8f293132fd127aa5bf88607c5678aa2b2c077e /drivers/gpu/drm/i915/i915_gem.c | |
parent | dfc5148fb3f935936e47b55f270cf10fcaf08487 (diff) | |
download | linux-stable-a933568eb61d6c0b12af4264ae1ba316447a2189.tar.gz linux-stable-a933568eb61d6c0b12af4264ae1ba316447a2189.tar.bz2 linux-stable-a933568eb61d6c0b12af4264ae1ba316447a2189.zip |
drm/i915: Tidy slab cache allocations
We can use the preferred KMEM_CACHE helper for brevity.
Also simplifiy error unwind by only setting the ENOMEM
error code once.
v2: Add forgotten changes. (Joonas Lahtinen)
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> (v1)
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1478099699-28652-1-git-send-email-tvrtko.ursulin@linux.intel.com
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 5839bebba64a..1f995ced524e 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -4714,39 +4714,22 @@ int i915_gem_load_init(struct drm_device *dev) { struct drm_i915_private *dev_priv = to_i915(dev); - int err; + int err = -ENOMEM; - dev_priv->objects = - kmem_cache_create("i915_gem_object", - sizeof(struct drm_i915_gem_object), 0, - SLAB_HWCACHE_ALIGN, - NULL); - if (!dev_priv->objects) { - err = -ENOMEM; + dev_priv->objects = KMEM_CACHE(drm_i915_gem_object, SLAB_HWCACHE_ALIGN); + if (!dev_priv->objects) goto err_out; - } - dev_priv->vmas = - kmem_cache_create("i915_gem_vma", - sizeof(struct i915_vma), 0, - SLAB_HWCACHE_ALIGN, - NULL); - if (!dev_priv->vmas) { - err = -ENOMEM; + dev_priv->vmas = KMEM_CACHE(i915_vma, SLAB_HWCACHE_ALIGN); + if (!dev_priv->vmas) goto err_objects; - } - dev_priv->requests = - kmem_cache_create("i915_gem_request", - sizeof(struct drm_i915_gem_request), 0, - SLAB_HWCACHE_ALIGN | - SLAB_RECLAIM_ACCOUNT | - SLAB_DESTROY_BY_RCU, - NULL); - if (!dev_priv->requests) { - err = -ENOMEM; + dev_priv->requests = KMEM_CACHE(drm_i915_gem_request, + SLAB_HWCACHE_ALIGN | + SLAB_RECLAIM_ACCOUNT | + SLAB_DESTROY_BY_RCU); + if (!dev_priv->requests) goto err_vmas; - } mutex_lock(&dev_priv->drm.struct_mutex); INIT_LIST_HEAD(&dev_priv->gt.timelines); |