提交 b84cfde2 编写于 作者: L Lucas Stach 提交者: Xie XiuQi

drm/etnaviv: add missing failure path to destroy suballoc

commit be132e13 upstream.

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

Fixes: e66774dd (drm/etnaviv: add cmdbuf suballocator)
Signed-off-by: NLucas Stach <l.stach@pengutronix.de>
Tested-by: NRussell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 5e71f6f2
...@@ -760,7 +760,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu) ...@@ -760,7 +760,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
if (IS_ERR(gpu->cmdbuf_suballoc)) { if (IS_ERR(gpu->cmdbuf_suballoc)) {
dev_err(gpu->dev, "Failed to create cmdbuf suballocator\n"); dev_err(gpu->dev, "Failed to create cmdbuf suballocator\n");
ret = PTR_ERR(gpu->cmdbuf_suballoc); ret = PTR_ERR(gpu->cmdbuf_suballoc);
goto fail; goto destroy_iommu;
} }
/* Create buffer: */ /* Create buffer: */
...@@ -768,7 +768,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu) ...@@ -768,7 +768,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
PAGE_SIZE); PAGE_SIZE);
if (ret) { if (ret) {
dev_err(gpu->dev, "could not create command buffer\n"); dev_err(gpu->dev, "could not create command buffer\n");
goto destroy_iommu; goto destroy_suballoc;
} }
if (gpu->mmu->version == ETNAVIV_IOMMU_V1 && if (gpu->mmu->version == ETNAVIV_IOMMU_V1 &&
...@@ -800,6 +800,9 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu) ...@@ -800,6 +800,9 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
free_buffer: free_buffer:
etnaviv_cmdbuf_free(&gpu->buffer); etnaviv_cmdbuf_free(&gpu->buffer);
gpu->buffer.suballoc = NULL; gpu->buffer.suballoc = NULL;
destroy_suballoc:
etnaviv_cmdbuf_suballoc_destroy(gpu->cmdbuf_suballoc);
gpu->cmdbuf_suballoc = NULL;
destroy_iommu: destroy_iommu:
etnaviv_iommu_destroy(gpu->mmu); etnaviv_iommu_destroy(gpu->mmu);
gpu->mmu = NULL; gpu->mmu = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册