All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/etnaviv: add missing failure path to destroy suballoc
@ 2019-06-27 14:44 Lucas Stach
  2019-06-27 16:26 ` Russell King - ARM Linux admin
  2019-06-27 16:35 ` Fabio Estevam
  0 siblings, 2 replies; 3+ messages in thread
From: Lucas Stach @ 2019-06-27 14:44 UTC (permalink / raw)
  To: Russell King - ARM Linux admin; +Cc: etnaviv, dri-devel

When something goes wrong in the GPU init after the cmdbuf suballocator
has been constructed, we fail to destory it properly. This causes havok
later when the GPU is unbound due to a module unload or similar.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index 72d01e873160..5418a1a87b2c 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -760,7 +760,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
 	if (IS_ERR(gpu->cmdbuf_suballoc)) {
 		dev_err(gpu->dev, "Failed to create cmdbuf suballocator\n");
 		ret = PTR_ERR(gpu->cmdbuf_suballoc);
-		goto fail;
+		goto destroy_iommu;
 	}
 
 	/* Create buffer: */
@@ -768,7 +768,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
 				  PAGE_SIZE);
 	if (ret) {
 		dev_err(gpu->dev, "could not create command buffer\n");
-		goto destroy_iommu;
+		goto destroy_suballoc;
 	}
 
 	if (gpu->mmu->version == ETNAVIV_IOMMU_V1 &&
@@ -800,6 +800,9 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
 free_buffer:
 	etnaviv_cmdbuf_free(&gpu->buffer);
 	gpu->buffer.suballoc = NULL;
+destroy_suballoc:
+	etnaviv_cmdbuf_suballoc_destroy(gpu->cmdbuf_suballoc);
+	gpu->cmdbuf_suballoc = NULL;
 destroy_iommu:
 	etnaviv_iommu_destroy(gpu->mmu);
 	gpu->mmu = NULL;
-- 
2.20.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/etnaviv: add missing failure path to destroy suballoc
  2019-06-27 14:44 [PATCH] drm/etnaviv: add missing failure path to destroy suballoc Lucas Stach
@ 2019-06-27 16:26 ` Russell King - ARM Linux admin
  2019-06-27 16:35 ` Fabio Estevam
  1 sibling, 0 replies; 3+ messages in thread
From: Russell King - ARM Linux admin @ 2019-06-27 16:26 UTC (permalink / raw)
  To: Lucas Stach; +Cc: etnaviv, dri-devel

On Thu, Jun 27, 2019 at 04:44:38PM +0200, Lucas Stach wrote:
> When something goes wrong in the GPU init after the cmdbuf suballocator
> has been constructed, we fail to destory it properly. This causes havok
> later when the GPU is unbound due to a module unload or similar.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Tested-by: Russell King <rmk+kernel@armlinux.org.uk>

Thanks.

> ---
>  drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> index 72d01e873160..5418a1a87b2c 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> @@ -760,7 +760,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
>  	if (IS_ERR(gpu->cmdbuf_suballoc)) {
>  		dev_err(gpu->dev, "Failed to create cmdbuf suballocator\n");
>  		ret = PTR_ERR(gpu->cmdbuf_suballoc);
> -		goto fail;
> +		goto destroy_iommu;
>  	}
>  
>  	/* Create buffer: */
> @@ -768,7 +768,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
>  				  PAGE_SIZE);
>  	if (ret) {
>  		dev_err(gpu->dev, "could not create command buffer\n");
> -		goto destroy_iommu;
> +		goto destroy_suballoc;
>  	}
>  
>  	if (gpu->mmu->version == ETNAVIV_IOMMU_V1 &&
> @@ -800,6 +800,9 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
>  free_buffer:
>  	etnaviv_cmdbuf_free(&gpu->buffer);
>  	gpu->buffer.suballoc = NULL;
> +destroy_suballoc:
> +	etnaviv_cmdbuf_suballoc_destroy(gpu->cmdbuf_suballoc);
> +	gpu->cmdbuf_suballoc = NULL;
>  destroy_iommu:
>  	etnaviv_iommu_destroy(gpu->mmu);
>  	gpu->mmu = NULL;
> -- 
> 2.20.1
> 
> 

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/etnaviv: add missing failure path to destroy suballoc
  2019-06-27 14:44 [PATCH] drm/etnaviv: add missing failure path to destroy suballoc Lucas Stach
  2019-06-27 16:26 ` Russell King - ARM Linux admin
@ 2019-06-27 16:35 ` Fabio Estevam
  1 sibling, 0 replies; 3+ messages in thread
From: Fabio Estevam @ 2019-06-27 16:35 UTC (permalink / raw)
  To: Lucas Stach
  Cc: Russell King - ARM Linux admin, DRI mailing list, The etnaviv authors

Hi Lucas,

On Thu, Jun 27, 2019 at 11:44 AM Lucas Stach <l.stach@pengutronix.de> wrote:
>
> When something goes wrong in the GPU init after the cmdbuf suballocator
> has been constructed, we fail to destory it properly. This causes havok

s/destory/destroy

> later when the GPU is unbound due to a module unload or similar.

Should this one have a Fixes tag?

Thanks
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2019-06-27 16:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-27 14:44 [PATCH] drm/etnaviv: add missing failure path to destroy suballoc Lucas Stach
2019-06-27 16:26 ` Russell King - ARM Linux admin
2019-06-27 16:35 ` Fabio Estevam

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.