diff mbox series

[1/2] gpu: host1x: Fix an error handling path in 'host1x_probe()'

Message ID 05c1932b66048ebf6742705e2ab16eea852c46d9.1636319710.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State New, archived
Headers show
Series [1/2] gpu: host1x: Fix an error handling path in 'host1x_probe()' | expand

Commit Message

Christophe JAILLET Nov. 7, 2021, 9:16 p.m. UTC
Add the missing 'host1x_bo_cache_destroy()' call in the error handling
path of the probe, as already done in the remove function.

In order to simplify the error handling, move the 'host1x_bo_cache_init()'
call after all the devm_ function.

Fixes: e3166698a8a0 ("drm/tegra: Implement buffer object cache")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Untested.
I hope that moving host1x_bo_cache_init() is just fine.
---
 drivers/gpu/host1x/dev.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Thierry Reding Feb. 25, 2022, 1:50 p.m. UTC | #1
On Sun, Nov 07, 2021 at 10:16:25PM +0100, Christophe JAILLET wrote:
> Add the missing 'host1x_bo_cache_destroy()' call in the error handling
> path of the probe, as already done in the remove function.
> 
> In order to simplify the error handling, move the 'host1x_bo_cache_init()'
> call after all the devm_ function.
> 
> Fixes: e3166698a8a0 ("drm/tegra: Implement buffer object cache")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Untested.
> I hope that moving host1x_bo_cache_init() is just fine.
> ---
>  drivers/gpu/host1x/dev.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)

Applied, thanks.

Thierry
diff mbox series

Patch

diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index 3d4cabdbc78d..fa00e31ea2f9 100644
--- a/drivers/gpu/host1x/dev.c
+++ b/drivers/gpu/host1x/dev.c
@@ -404,7 +404,6 @@  static int host1x_probe(struct platform_device *pdev)
 	if (syncpt_irq < 0)
 		return syncpt_irq;
 
-	host1x_bo_cache_init(&host->cache);
 	mutex_init(&host->devices_lock);
 	INIT_LIST_HEAD(&host->devices);
 	INIT_LIST_HEAD(&host->list);
@@ -449,10 +448,12 @@  static int host1x_probe(struct platform_device *pdev)
 		return err;
 	}
 
+	host1x_bo_cache_init(&host->cache);
+
 	err = host1x_iommu_init(host);
 	if (err < 0) {
 		dev_err(&pdev->dev, "failed to setup IOMMU: %d\n", err);
-		return err;
+		goto destroy_cache;
 	}
 
 	err = host1x_channel_list_init(&host->channel_list,
@@ -516,6 +517,8 @@  static int host1x_probe(struct platform_device *pdev)
 	host1x_channel_list_free(&host->channel_list);
 iommu_exit:
 	host1x_iommu_exit(host);
+destroy_cache:
+	host1x_bo_cache_destroy(&host->cache);
 
 	return err;
 }