gpu: host1x: Correct host1x_job_pin() error handling
authorDmitry Osipenko <digetx@gmail.com>
Wed, 14 Jun 2017 23:18:33 +0000 (02:18 +0300)
committerThierry Reding <treding@nvidia.com>
Thu, 15 Jun 2017 12:21:46 +0000 (14:21 +0200)
In case of relocations / waitchecks patching failure the jobs pins stay
referenced till DRM file get closed, wasting memory. Add the missed
unpinning.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Reviewed-by: Erik Faye-Lund <kusmabite@gmail.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/host1x/job.c

index d9933828fe87e897a3643f77b44662274638c1c0..14f3f957ffab602b07cb4d5dc60ff2d294d77bc6 100644 (file)
@@ -592,22 +592,20 @@ int host1x_job_pin(struct host1x_job *job, struct device *dev)
 
                err = do_relocs(job, g->bo);
                if (err)
-                       break;
+                       goto out;
 
                err = do_waitchks(job, host, g->bo);
                if (err)
-                       break;
+                       goto out;
        }
 
-       if (IS_ENABLED(CONFIG_TEGRA_HOST1X_FIREWALL) && !err) {
-               err = copy_gathers(job, dev);
-               if (err) {
-                       host1x_job_unpin(job);
-                       return err;
-               }
-       }
+       if (!IS_ENABLED(CONFIG_TEGRA_HOST1X_FIREWALL))
+               goto out;
 
+       err = copy_gathers(job, dev);
 out:
+       if (err)
+               host1x_job_unpin(job);
        wmb();
 
        return err;