linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] gpu: host1x: Fix an error handling path in 'host1x_probe()'
@ 2021-11-07 21:16 Christophe JAILLET
  2021-11-07 21:16 ` [PATCH 2/2] gpu: host1x: Fix a memory leak in 'host1x_remove()' Christophe JAILLET
  2022-02-25 13:50 ` [PATCH 1/2] gpu: host1x: Fix an error handling path in 'host1x_probe()' Thierry Reding
  0 siblings, 2 replies; 4+ messages in thread
From: Christophe JAILLET @ 2021-11-07 21:16 UTC (permalink / raw)
  To: thierry.reding, airlied, daniel
  Cc: dri-devel, linux-tegra, linux-kernel, kernel-janitors,
	Christophe JAILLET

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(-)

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;
 }
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] gpu: host1x: Fix a memory leak in 'host1x_remove()'
  2021-11-07 21:16 [PATCH 1/2] gpu: host1x: Fix an error handling path in 'host1x_probe()' Christophe JAILLET
@ 2021-11-07 21:16 ` Christophe JAILLET
  2022-02-25 13:54   ` Thierry Reding
  2022-02-25 13:50 ` [PATCH 1/2] gpu: host1x: Fix an error handling path in 'host1x_probe()' Thierry Reding
  1 sibling, 1 reply; 4+ messages in thread
From: Christophe JAILLET @ 2021-11-07 21:16 UTC (permalink / raw)
  To: thierry.reding, airlied, daniel
  Cc: dri-devel, linux-tegra, linux-kernel, kernel-janitors,
	Christophe JAILLET

Add a missing 'host1x_channel_list_free()' call in the remove function,
as already done in the error handling path of the probe function.

Fixes: 8474b02531c4 ("gpu: host1x: Refactor channel allocation code")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/gpu/host1x/dev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index fa00e31ea2f9..6cc749f030ee 100644
--- a/drivers/gpu/host1x/dev.c
+++ b/drivers/gpu/host1x/dev.c
@@ -533,6 +533,7 @@ static int host1x_remove(struct platform_device *pdev)
 	host1x_syncpt_deinit(host);
 	reset_control_assert(host->rst);
 	clk_disable_unprepare(host->clk);
+	host1x_channel_list_free(&host->channel_list);
 	host1x_iommu_exit(host);
 	host1x_bo_cache_destroy(&host->cache);
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] gpu: host1x: Fix an error handling path in 'host1x_probe()'
  2021-11-07 21:16 [PATCH 1/2] gpu: host1x: Fix an error handling path in 'host1x_probe()' Christophe JAILLET
  2021-11-07 21:16 ` [PATCH 2/2] gpu: host1x: Fix a memory leak in 'host1x_remove()' Christophe JAILLET
@ 2022-02-25 13:50 ` Thierry Reding
  1 sibling, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2022-02-25 13:50 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: airlied, daniel, linux-tegra, kernel-janitors, linux-kernel, dri-devel

[-- Attachment #1: Type: text/plain, Size: 676 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] gpu: host1x: Fix a memory leak in 'host1x_remove()'
  2021-11-07 21:16 ` [PATCH 2/2] gpu: host1x: Fix a memory leak in 'host1x_remove()' Christophe JAILLET
@ 2022-02-25 13:54   ` Thierry Reding
  0 siblings, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2022-02-25 13:54 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: airlied, daniel, linux-tegra, kernel-janitors, linux-kernel, dri-devel

[-- Attachment #1: Type: text/plain, Size: 467 bytes --]

On Sun, Nov 07, 2021 at 10:16:36PM +0100, Christophe JAILLET wrote:
> Add a missing 'host1x_channel_list_free()' call in the remove function,
> as already done in the error handling path of the probe function.
> 
> Fixes: 8474b02531c4 ("gpu: host1x: Refactor channel allocation code")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/gpu/host1x/dev.c | 1 +
>  1 file changed, 1 insertion(+)

Applied, thanks.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-25 13:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-07 21:16 [PATCH 1/2] gpu: host1x: Fix an error handling path in 'host1x_probe()' Christophe JAILLET
2021-11-07 21:16 ` [PATCH 2/2] gpu: host1x: Fix a memory leak in 'host1x_remove()' Christophe JAILLET
2022-02-25 13:54   ` Thierry Reding
2022-02-25 13:50 ` [PATCH 1/2] gpu: host1x: Fix an error handling path in 'host1x_probe()' Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).