All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu/mes: Fix an error handling path in amdgpu_mes_self_test()
@ 2022-07-05 13:46 ` Jianglei Nie
  0 siblings, 0 replies; 5+ messages in thread
From: Jianglei Nie @ 2022-07-05 13:46 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel,
	Jack.Xiao, Hawking.Zhang, mukul.joshi
  Cc: Jianglei Nie, dri-devel, amd-gfx, linux-kernel

if amdgpu_mes_ctx_alloc_meta_data() fails, we should call amdgpu_vm_fini()
to handle amdgpu_vm_init().

Add a new lable before amdgpu_vm_init() and goto this lable when
amdgpu_mes_ctx_alloc_meta_data() fails.

Signed-off-by: Jianglei Nie <niejianglei2021@163.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
index 69a70a0aaed9..7c196b8ac49f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
@@ -1157,7 +1157,7 @@ int amdgpu_mes_self_test(struct amdgpu_device *adev)
 	r = amdgpu_mes_ctx_alloc_meta_data(adev, &ctx_data);
 	if (r) {
 		DRM_ERROR("failed to alloc ctx meta data\n");
-		goto error_pasid;
+		goto error_fini;
 	}
 
 	ctx_data.meta_data_gpu_addr = AMDGPU_VA_RESERVED_SIZE;
@@ -1215,6 +1215,8 @@ int amdgpu_mes_self_test(struct amdgpu_device *adev)
 	BUG_ON(amdgpu_bo_reserve(ctx_data.meta_data_obj, true));
 	amdgpu_vm_bo_del(adev, ctx_data.meta_data_va);
 	amdgpu_bo_unreserve(ctx_data.meta_data_obj);
+
+error_fini:
 	amdgpu_vm_fini(adev, vm);
 
 error_pasid:
-- 
2.25.1


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

* [PATCH] drm/amdgpu/mes: Fix an error handling path in amdgpu_mes_self_test()
@ 2022-07-05 13:46 ` Jianglei Nie
  0 siblings, 0 replies; 5+ messages in thread
From: Jianglei Nie @ 2022-07-05 13:46 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel,
	Jack.Xiao, Hawking.Zhang, mukul.joshi
  Cc: amd-gfx, dri-devel, linux-kernel, Jianglei Nie

if amdgpu_mes_ctx_alloc_meta_data() fails, we should call amdgpu_vm_fini()
to handle amdgpu_vm_init().

Add a new lable before amdgpu_vm_init() and goto this lable when
amdgpu_mes_ctx_alloc_meta_data() fails.

Signed-off-by: Jianglei Nie <niejianglei2021@163.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
index 69a70a0aaed9..7c196b8ac49f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
@@ -1157,7 +1157,7 @@ int amdgpu_mes_self_test(struct amdgpu_device *adev)
 	r = amdgpu_mes_ctx_alloc_meta_data(adev, &ctx_data);
 	if (r) {
 		DRM_ERROR("failed to alloc ctx meta data\n");
-		goto error_pasid;
+		goto error_fini;
 	}
 
 	ctx_data.meta_data_gpu_addr = AMDGPU_VA_RESERVED_SIZE;
@@ -1215,6 +1215,8 @@ int amdgpu_mes_self_test(struct amdgpu_device *adev)
 	BUG_ON(amdgpu_bo_reserve(ctx_data.meta_data_obj, true));
 	amdgpu_vm_bo_del(adev, ctx_data.meta_data_va);
 	amdgpu_bo_unreserve(ctx_data.meta_data_obj);
+
+error_fini:
 	amdgpu_vm_fini(adev, vm);
 
 error_pasid:
-- 
2.25.1


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

* Re: [PATCH] drm/amdgpu/mes: Fix an error handling path in amdgpu_mes_self_test()
  2022-07-05 13:46 ` Jianglei Nie
  (?)
@ 2022-07-05 15:07   ` Alex Deucher
  -1 siblings, 0 replies; 5+ messages in thread
From: Alex Deucher @ 2022-07-05 15:07 UTC (permalink / raw)
  To: Jianglei Nie
  Cc: Joshi, Mukul, Jack Xiao, Dave Airlie, xinhui pan, LKML,
	Maling list - DRI developers, amd-gfx list, Deucher, Alexander,
	Christian Koenig, Hawking Zhang

Applied.  Thanks!

On Tue, Jul 5, 2022 at 9:46 AM Jianglei Nie <niejianglei2021@163.com> wrote:
>
> if amdgpu_mes_ctx_alloc_meta_data() fails, we should call amdgpu_vm_fini()
> to handle amdgpu_vm_init().
>
> Add a new lable before amdgpu_vm_init() and goto this lable when
> amdgpu_mes_ctx_alloc_meta_data() fails.
>
> Signed-off-by: Jianglei Nie <niejianglei2021@163.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
> index 69a70a0aaed9..7c196b8ac49f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
> @@ -1157,7 +1157,7 @@ int amdgpu_mes_self_test(struct amdgpu_device *adev)
>         r = amdgpu_mes_ctx_alloc_meta_data(adev, &ctx_data);
>         if (r) {
>                 DRM_ERROR("failed to alloc ctx meta data\n");
> -               goto error_pasid;
> +               goto error_fini;
>         }
>
>         ctx_data.meta_data_gpu_addr = AMDGPU_VA_RESERVED_SIZE;
> @@ -1215,6 +1215,8 @@ int amdgpu_mes_self_test(struct amdgpu_device *adev)
>         BUG_ON(amdgpu_bo_reserve(ctx_data.meta_data_obj, true));
>         amdgpu_vm_bo_del(adev, ctx_data.meta_data_va);
>         amdgpu_bo_unreserve(ctx_data.meta_data_obj);
> +
> +error_fini:
>         amdgpu_vm_fini(adev, vm);
>
>  error_pasid:
> --
> 2.25.1
>

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

* Re: [PATCH] drm/amdgpu/mes: Fix an error handling path in amdgpu_mes_self_test()
@ 2022-07-05 15:07   ` Alex Deucher
  0 siblings, 0 replies; 5+ messages in thread
From: Alex Deucher @ 2022-07-05 15:07 UTC (permalink / raw)
  To: Jianglei Nie
  Cc: Joshi, Mukul, Jack Xiao, Dave Airlie, xinhui pan, LKML,
	Maling list - DRI developers, amd-gfx list, Daniel Vetter,
	Deucher, Alexander, Christian Koenig, Hawking Zhang

Applied.  Thanks!

On Tue, Jul 5, 2022 at 9:46 AM Jianglei Nie <niejianglei2021@163.com> wrote:
>
> if amdgpu_mes_ctx_alloc_meta_data() fails, we should call amdgpu_vm_fini()
> to handle amdgpu_vm_init().
>
> Add a new lable before amdgpu_vm_init() and goto this lable when
> amdgpu_mes_ctx_alloc_meta_data() fails.
>
> Signed-off-by: Jianglei Nie <niejianglei2021@163.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
> index 69a70a0aaed9..7c196b8ac49f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
> @@ -1157,7 +1157,7 @@ int amdgpu_mes_self_test(struct amdgpu_device *adev)
>         r = amdgpu_mes_ctx_alloc_meta_data(adev, &ctx_data);
>         if (r) {
>                 DRM_ERROR("failed to alloc ctx meta data\n");
> -               goto error_pasid;
> +               goto error_fini;
>         }
>
>         ctx_data.meta_data_gpu_addr = AMDGPU_VA_RESERVED_SIZE;
> @@ -1215,6 +1215,8 @@ int amdgpu_mes_self_test(struct amdgpu_device *adev)
>         BUG_ON(amdgpu_bo_reserve(ctx_data.meta_data_obj, true));
>         amdgpu_vm_bo_del(adev, ctx_data.meta_data_va);
>         amdgpu_bo_unreserve(ctx_data.meta_data_obj);
> +
> +error_fini:
>         amdgpu_vm_fini(adev, vm);
>
>  error_pasid:
> --
> 2.25.1
>

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

* Re: [PATCH] drm/amdgpu/mes: Fix an error handling path in amdgpu_mes_self_test()
@ 2022-07-05 15:07   ` Alex Deucher
  0 siblings, 0 replies; 5+ messages in thread
From: Alex Deucher @ 2022-07-05 15:07 UTC (permalink / raw)
  To: Jianglei Nie
  Cc: Deucher, Alexander, Christian Koenig, xinhui pan, Dave Airlie,
	Daniel Vetter, Jack Xiao, Hawking Zhang, Joshi, Mukul,
	Maling list - DRI developers, amd-gfx list, LKML

Applied.  Thanks!

On Tue, Jul 5, 2022 at 9:46 AM Jianglei Nie <niejianglei2021@163.com> wrote:
>
> if amdgpu_mes_ctx_alloc_meta_data() fails, we should call amdgpu_vm_fini()
> to handle amdgpu_vm_init().
>
> Add a new lable before amdgpu_vm_init() and goto this lable when
> amdgpu_mes_ctx_alloc_meta_data() fails.
>
> Signed-off-by: Jianglei Nie <niejianglei2021@163.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
> index 69a70a0aaed9..7c196b8ac49f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
> @@ -1157,7 +1157,7 @@ int amdgpu_mes_self_test(struct amdgpu_device *adev)
>         r = amdgpu_mes_ctx_alloc_meta_data(adev, &ctx_data);
>         if (r) {
>                 DRM_ERROR("failed to alloc ctx meta data\n");
> -               goto error_pasid;
> +               goto error_fini;
>         }
>
>         ctx_data.meta_data_gpu_addr = AMDGPU_VA_RESERVED_SIZE;
> @@ -1215,6 +1215,8 @@ int amdgpu_mes_self_test(struct amdgpu_device *adev)
>         BUG_ON(amdgpu_bo_reserve(ctx_data.meta_data_obj, true));
>         amdgpu_vm_bo_del(adev, ctx_data.meta_data_va);
>         amdgpu_bo_unreserve(ctx_data.meta_data_obj);
> +
> +error_fini:
>         amdgpu_vm_fini(adev, vm);
>
>  error_pasid:
> --
> 2.25.1
>

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

end of thread, other threads:[~2022-07-05 15:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-05 13:46 [PATCH] drm/amdgpu/mes: Fix an error handling path in amdgpu_mes_self_test() Jianglei Nie
2022-07-05 13:46 ` Jianglei Nie
2022-07-05 15:07 ` Alex Deucher
2022-07-05 15:07   ` Alex Deucher
2022-07-05 15:07   ` Alex Deucher

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.