diff mbox

[12/22] gpu: host1x: Correct host1x_job_pin() error handling

Message ID a153e811388386c26d21e26ac4deb72a4d01ae74.1495498184.git.digetx@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dmitry Osipenko May 23, 2017, 12:14 a.m. UTC
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>
---
 drivers/gpu/host1x/job.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

Comments

Mikko Perttunen May 31, 2017, 6:50 p.m. UTC | #1
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>

On 05/23/2017 03:14 AM, Dmitry Osipenko wrote:
> 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>
> ---
>   drivers/gpu/host1x/job.c | 16 +++++++---------
>   1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c
> index d9933828fe87..14f3f957ffab 100644
> --- a/drivers/gpu/host1x/job.c
> +++ b/drivers/gpu/host1x/job.c
> @@ -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;
>
diff mbox

Patch

diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c
index d9933828fe87..14f3f957ffab 100644
--- a/drivers/gpu/host1x/job.c
+++ b/drivers/gpu/host1x/job.c
@@ -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;