Commit d9a7ed77 authored by Markus Elfring's avatar Markus Elfring Committed by Sean Paul

drm/etnaviv: Optimize error handling in etnaviv_gem_new_userptr()

Refactor this function implementation so that the
drm_gem_object_unreference_unlocked() function will only be called once
in case of a failure according to the Linux coding style recommendation
for centralized exiting of functions.
Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
[seanpaul tweaked subject]
Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/4af34ce6-62c6-7966-1ae3-0877d5ac909d@users.sourceforge.net
parent 8c6e6188
...@@ -913,15 +913,12 @@ int etnaviv_gem_new_userptr(struct drm_device *dev, struct drm_file *file, ...@@ -913,15 +913,12 @@ int etnaviv_gem_new_userptr(struct drm_device *dev, struct drm_file *file,
get_task_struct(current); get_task_struct(current);
ret = etnaviv_gem_obj_add(dev, &etnaviv_obj->base); ret = etnaviv_gem_obj_add(dev, &etnaviv_obj->base);
if (ret) { if (ret)
drm_gem_object_unreference_unlocked(&etnaviv_obj->base); goto unreference;
return ret;
}
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_unreference_unlocked(&etnaviv_obj->base); drm_gem_object_unreference_unlocked(&etnaviv_obj->base);
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