summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRob Clark <robdclark@gmail.com>2016-02-03 13:24:35 -0500
committerRob Clark <robdclark@gmail.com>2016-03-03 11:55:30 -0500
commit687f084a3bd01d932bb870a21fe92496055697d6 (patch)
tree0421a1dadb4c653497c70aa9a82357b94ead6e9e /drivers
parentc01a958eca6e7f23bc49058feb66942ebcacb277 (diff)
downloadlinux-687f084a3bd01d932bb870a21fe92496055697d6.tar.gz
linux-687f084a3bd01d932bb870a21fe92496055697d6.tar.bz2
linux-687f084a3bd01d932bb870a21fe92496055697d6.zip
drm/msm: grab struct_mutex after allocating submit
No real need to hold the lock over allocation, and simplifies things slightly if we change the order. Signed-off-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/msm/msm_gem_submit.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
index 06f6ea9ccba0..43d2181231c0 100644
--- a/drivers/gpu/drm/msm/msm_gem_submit.c
+++ b/drivers/gpu/drm/msm/msm_gem_submit.c
@@ -339,13 +339,11 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
if (args->nr_cmds > MAX_CMDS)
return -EINVAL;
- mutex_lock(&dev->struct_mutex);
-
submit = submit_create(dev, gpu, args->nr_bos);
- if (!submit) {
- ret = -ENOMEM;
- goto out;
- }
+ if (!submit)
+ return -ENOMEM;
+
+ mutex_lock(&dev->struct_mutex);
ret = submit_lookup_objects(submit, args, file);
if (ret)
@@ -420,8 +418,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
args->fence = submit->fence;
out:
- if (submit)
- submit_cleanup(submit, !!ret);
+ submit_cleanup(submit, !!ret);
mutex_unlock(&dev->struct_mutex);
return ret;
}