[1/2] drm/tegra: Fix order of teardown in IOMMU case

Message ID 20180423065745.26102-1-thierry.reding@gmail.com
State New
Headers show
Series
  • [1/2] drm/tegra: Fix order of teardown in IOMMU case
Related show

Commit Message

Thierry Reding April 23, 2018, 6:57 a.m.
From: Thierry Reding <treding@nvidia.com>

The original code works fine, this is merely a cosmetic change to make
the teardown order the reverse of the setup order.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/gpu/drm/tegra/drm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Dmitry Osipenko April 23, 2018, 8:35 a.m. | #1
On 23.04.2018 09:57, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> The original code works fine, this is merely a cosmetic change to make
> the teardown order the reverse of the setup order.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>

> ---
>  drivers/gpu/drm/tegra/drm.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
> index 1cfe1e7e2feb..4a696fa274a3 100644
> --- a/drivers/gpu/drm/tegra/drm.c
> +++ b/drivers/gpu/drm/tegra/drm.c
> @@ -207,10 +207,10 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags)
>  	drm_mode_config_cleanup(drm);
>  
>  	if (tegra->domain) {
> -		iommu_domain_free(tegra->domain);
> -		drm_mm_takedown(&tegra->mm);
>  		mutex_destroy(&tegra->mm_lock);
> +		drm_mm_takedown(&tegra->mm);
>  		put_iova_domain(&tegra->carveout.domain);
> +		iommu_domain_free(tegra->domain);
>  	}
>  free:
>  	kfree(tegra);
> @@ -233,10 +233,10 @@ static void tegra_drm_unload(struct drm_device *drm)
>  		return;
>  
>  	if (tegra->domain) {
> -		iommu_domain_free(tegra->domain);
> -		drm_mm_takedown(&tegra->mm);
>  		mutex_destroy(&tegra->mm_lock);
> +		drm_mm_takedown(&tegra->mm);
>  		put_iova_domain(&tegra->carveout.domain);
> +		iommu_domain_free(tegra->domain);
>  	}
>  
>  	kfree(tegra);
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thierry Reding May 14, 2018, 8:59 a.m. | #2
On Mon, Apr 23, 2018 at 11:35:14AM +0300, Dmitry Osipenko wrote:
> On 23.04.2018 09:57, Thierry Reding wrote:
> > From: Thierry Reding <treding@nvidia.com>
> > 
> > The original code works fine, this is merely a cosmetic change to make
> > the teardown order the reverse of the setup order.
> > 
> > Signed-off-by: Thierry Reding <treding@nvidia.com>
> Reviewed-by: Dmitry Osipenko <digetx@gmail.com>

Applied, thanks.

Thierry

Patch

diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 1cfe1e7e2feb..4a696fa274a3 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -207,10 +207,10 @@  static int tegra_drm_load(struct drm_device *drm, unsigned long flags)
 	drm_mode_config_cleanup(drm);
 
 	if (tegra->domain) {
-		iommu_domain_free(tegra->domain);
-		drm_mm_takedown(&tegra->mm);
 		mutex_destroy(&tegra->mm_lock);
+		drm_mm_takedown(&tegra->mm);
 		put_iova_domain(&tegra->carveout.domain);
+		iommu_domain_free(tegra->domain);
 	}
 free:
 	kfree(tegra);
@@ -233,10 +233,10 @@  static void tegra_drm_unload(struct drm_device *drm)
 		return;
 
 	if (tegra->domain) {
-		iommu_domain_free(tegra->domain);
-		drm_mm_takedown(&tegra->mm);
 		mutex_destroy(&tegra->mm_lock);
+		drm_mm_takedown(&tegra->mm);
 		put_iova_domain(&tegra->carveout.domain);
+		iommu_domain_free(tegra->domain);
 	}
 
 	kfree(tegra);