Commit 54f09288 authored by Lucas Stach's avatar Lucas Stach

drm/etnaviv: change return type of etnaviv_gem_obj_add to void

This function never fails, as it does nothing more than adding the GEM
object to the global device list. Making this explicit through the void
return type allows to drop some unnecessary error handling.
Signed-off-by: default avatarLucas Stach <l.stach@pengutronix.de>
Reviewed-by: default avatarChristian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
parent cdd32563
...@@ -586,7 +586,7 @@ void etnaviv_gem_free_object(struct drm_gem_object *obj) ...@@ -586,7 +586,7 @@ void etnaviv_gem_free_object(struct drm_gem_object *obj)
kfree(etnaviv_obj); kfree(etnaviv_obj);
} }
int etnaviv_gem_obj_add(struct drm_device *dev, struct drm_gem_object *obj) void etnaviv_gem_obj_add(struct drm_device *dev, struct drm_gem_object *obj)
{ {
struct etnaviv_drm_private *priv = dev->dev_private; struct etnaviv_drm_private *priv = dev->dev_private;
struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj); struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);
...@@ -594,8 +594,6 @@ int etnaviv_gem_obj_add(struct drm_device *dev, struct drm_gem_object *obj) ...@@ -594,8 +594,6 @@ int etnaviv_gem_obj_add(struct drm_device *dev, struct drm_gem_object *obj)
mutex_lock(&priv->gem_lock); mutex_lock(&priv->gem_lock);
list_add_tail(&etnaviv_obj->gem_node, &priv->gem_list); list_add_tail(&etnaviv_obj->gem_node, &priv->gem_list);
mutex_unlock(&priv->gem_lock); mutex_unlock(&priv->gem_lock);
return 0;
} }
static int etnaviv_gem_new_impl(struct drm_device *dev, u32 size, u32 flags, static int etnaviv_gem_new_impl(struct drm_device *dev, u32 size, u32 flags,
...@@ -678,11 +676,7 @@ int etnaviv_gem_new_handle(struct drm_device *dev, struct drm_file *file, ...@@ -678,11 +676,7 @@ int etnaviv_gem_new_handle(struct drm_device *dev, struct drm_file *file,
if (ret) if (ret)
goto fail; goto fail;
ret = etnaviv_gem_obj_add(dev, obj); etnaviv_gem_obj_add(dev, obj);
if (ret < 0) {
drm_gem_object_put_unlocked(obj);
return ret;
}
ret = drm_gem_handle_create(file, obj, handle); ret = drm_gem_handle_create(file, obj, handle);
...@@ -895,12 +889,10 @@ int etnaviv_gem_new_userptr(struct drm_device *dev, struct drm_file *file, ...@@ -895,12 +889,10 @@ int etnaviv_gem_new_userptr(struct drm_device *dev, struct drm_file *file,
etnaviv_obj->userptr.ro = !(flags & ETNA_USERPTR_WRITE); etnaviv_obj->userptr.ro = !(flags & ETNA_USERPTR_WRITE);
get_task_struct(current); get_task_struct(current);
ret = etnaviv_gem_obj_add(dev, &etnaviv_obj->base); etnaviv_gem_obj_add(dev, &etnaviv_obj->base);
if (ret)
goto unreference;
ret = drm_gem_handle_create(file, &etnaviv_obj->base, handle); ret = drm_gem_handle_create(file, &etnaviv_obj->base, handle);
unreference:
/* drop reference from allocate - handle holds it now */ /* drop reference from allocate - handle holds it now */
drm_gem_object_put_unlocked(&etnaviv_obj->base); drm_gem_object_put_unlocked(&etnaviv_obj->base);
return ret; return ret;
......
...@@ -117,7 +117,7 @@ int etnaviv_gem_wait_bo(struct etnaviv_gpu *gpu, struct drm_gem_object *obj, ...@@ -117,7 +117,7 @@ int etnaviv_gem_wait_bo(struct etnaviv_gpu *gpu, struct drm_gem_object *obj,
int etnaviv_gem_new_private(struct drm_device *dev, size_t size, u32 flags, int etnaviv_gem_new_private(struct drm_device *dev, size_t size, u32 flags,
struct reservation_object *robj, const struct etnaviv_gem_ops *ops, struct reservation_object *robj, const struct etnaviv_gem_ops *ops,
struct etnaviv_gem_object **res); struct etnaviv_gem_object **res);
int etnaviv_gem_obj_add(struct drm_device *dev, struct drm_gem_object *obj); void etnaviv_gem_obj_add(struct drm_device *dev, struct drm_gem_object *obj);
struct page **etnaviv_gem_get_pages(struct etnaviv_gem_object *obj); struct page **etnaviv_gem_get_pages(struct etnaviv_gem_object *obj);
void etnaviv_gem_put_pages(struct etnaviv_gem_object *obj); void etnaviv_gem_put_pages(struct etnaviv_gem_object *obj);
......
...@@ -142,9 +142,7 @@ struct drm_gem_object *etnaviv_gem_prime_import_sg_table(struct drm_device *dev, ...@@ -142,9 +142,7 @@ struct drm_gem_object *etnaviv_gem_prime_import_sg_table(struct drm_device *dev,
if (ret) if (ret)
goto fail; goto fail;
ret = etnaviv_gem_obj_add(dev, &etnaviv_obj->base); etnaviv_gem_obj_add(dev, &etnaviv_obj->base);
if (ret)
goto fail;
return &etnaviv_obj->base; return &etnaviv_obj->base;
......
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