diff mbox series

drm/ttm: cleanup the resource of ghost objects after locking them

Message ID 20220907152331.572240-1-christian.koenig@amd.com (mailing list archive)
State New, archived
Headers show
Series drm/ttm: cleanup the resource of ghost objects after locking them | expand

Commit Message

Christian König Sept. 7, 2022, 3:23 p.m. UTC
Otherwise lockdep will complain about cleaning up the bulk_move.

Not even compile tested.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/ttm/ttm_bo_util.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Matthew Auld Sept. 7, 2022, 4:01 p.m. UTC | #1
On Wed, 7 Sept 2022 at 16:23, Christian König
<ckoenig.leichtzumerken@gmail.com> wrote:
>
> Otherwise lockdep will complain about cleaning up the bulk_move.
>
> Not even compile tested.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>

CI looks better now. Thanks for the quick fix.

> ---
>  drivers/gpu/drm/ttm/ttm_bo_util.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
> index 57a27847206f..911141d16e95 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
> @@ -236,6 +236,11 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
>         if (bo->type != ttm_bo_type_sg)
>                 fbo->base.base.resv = &fbo->base.base._resv;
>
> +       dma_resv_init(&fbo->base.base._resv);
> +       fbo->base.base.dev = NULL;
> +       ret = dma_resv_trylock(&fbo->base.base._resv);
> +       WARN_ON(!ret);
> +
>         if (fbo->base.resource) {
>                 ttm_resource_set_bo(fbo->base.resource, &fbo->base);
>                 bo->resource = NULL;
> @@ -244,11 +249,6 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
>                 fbo->base.bulk_move = NULL;
>         }
>
> -       dma_resv_init(&fbo->base.base._resv);
> -       fbo->base.base.dev = NULL;
> -       ret = dma_resv_trylock(&fbo->base.base._resv);
> -       WARN_ON(!ret);
> -
>         ret = dma_resv_reserve_fences(&fbo->base.base._resv, 1);
>         if (ret) {
>                 kfree(fbo);
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 57a27847206f..911141d16e95 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -236,6 +236,11 @@  static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
 	if (bo->type != ttm_bo_type_sg)
 		fbo->base.base.resv = &fbo->base.base._resv;
 
+	dma_resv_init(&fbo->base.base._resv);
+	fbo->base.base.dev = NULL;
+	ret = dma_resv_trylock(&fbo->base.base._resv);
+	WARN_ON(!ret);
+
 	if (fbo->base.resource) {
 		ttm_resource_set_bo(fbo->base.resource, &fbo->base);
 		bo->resource = NULL;
@@ -244,11 +249,6 @@  static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
 		fbo->base.bulk_move = NULL;
 	}
 
-	dma_resv_init(&fbo->base.base._resv);
-	fbo->base.base.dev = NULL;
-	ret = dma_resv_trylock(&fbo->base.base._resv);
-	WARN_ON(!ret);
-
 	ret = dma_resv_reserve_fences(&fbo->base.base._resv, 1);
 	if (ret) {
 		kfree(fbo);