Skip to contentSkip to conversation

drm/imagination: Use pvr_vm_context_get()

PATCH Superseded Matt Coster 2 participants 4 messages Aug 28, 2024 – Sep 2, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/imagination: Use pvr_vm_context_get()

I missed this open-coded kref_get() while trying to debug a refcount bug, so let's use the helper function here to avoid that waste of time again in the future.

Fixes ff5f643de0bf ("drm/imagination: Add GEM and VM related code")
---
 drivers/gpu/drm/imagination/pvr_vm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/imagination/pvr_vm.c +1 -3
index e59517ba039e..ffd466509d0b 100644
@@ -636,9 +636,7 @@ pvr_vm_context_lookup(struct pvr_file *pvr_file, u32 handle)
  	xa_lock(&pvr_file->vm_ctx_handles);
 	vm_ctx = xa_load(&pvr_file->vm_ctx_handles, handle);
-	if (vm_ctx)
-		kref_get(&vm_ctx->ref_count);
-
+	pvr_vm_context_get(vm_ctx);
 	xa_unlock(&pvr_file->vm_ctx_handles);
  	return vm_ctx;
Signature · 1 line
2.46.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Matt Coster

I missed this open-coded kref_get() while trying to debug a refcount bug, so let's use the helper function here to avoid that waste of time again in the future.

Quoted 25 lines
Fixes ff5f643de0bf ("drm/imagination: Add GEM and VM related code")
---
  drivers/gpu/drm/imagination/pvr_vm.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/imagination/pvr_vm.c +1 -3
index e59517ba039e..ffd466509d0b 100644
@@ -636,9 +636,7 @@ pvr_vm_context_lookup(struct pvr_file *pvr_file, u32 
 handle)
   	xa_lock(&pvr_file->vm_ctx_handles);
  	vm_ctx = xa_load(&pvr_file->vm_ctx_handles, handle);
-	if (vm_ctx)
-		kref_get(&vm_ctx->ref_count);
-
+	pvr_vm_context_get(vm_ctx);
  	xa_unlock(&pvr_file->vm_ctx_handles);
   	return vm_ctx;
Signature · 1 line
2.46.0
#2 lore raw

PATCH RESEND 1/1 drm/imagination: Use pvr_vm_context_get()

In reply to Matt Coster

I missed this open-coded kref_get() while trying to debug a refcount bug, so let's use the helper function here to avoid that waste of time again in the future.

Fixes ff5f643de0bf ("drm/imagination: Add GEM and VM related code")
---
 drivers/gpu/drm/imagination/pvr_vm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/imagination/pvr_vm.c +1 -3
index e59517ba039e..ffd466509d0b 100644
@@ -636,9 +636,7 @@ pvr_vm_context_lookup(struct pvr_file *pvr_file, u32 handle)
 
 	xa_lock(&pvr_file->vm_ctx_handles);
 	vm_ctx = xa_load(&pvr_file->vm_ctx_handles, handle);
-	if (vm_ctx)
-		kref_get(&vm_ctx->ref_count);
-
+	pvr_vm_context_get(vm_ctx);
 	xa_unlock(&pvr_file->vm_ctx_handles);
 
 	return vm_ctx;
Signature · 1 line
2.46.0
Reviewed-by on v1 1/1
#3 lore raw
Quoted 4 lines · Matt Coster

I missed this open-coded kref_get() while trying to debug a refcount bug, so let's use the helper function here to avoid that waste of time again in the future.

Quoted 21 lines
Fixes ff5f643de0bf ("drm/imagination: Add GEM and VM related code")
---
 drivers/gpu/drm/imagination/pvr_vm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/imagination/pvr_vm.c +1 -3
index e59517ba039e..ffd466509d0b 100644
@@ -636,9 +636,7 @@ pvr_vm_context_lookup(struct pvr_file *pvr_file, u32 handle)
 
 	xa_lock(&pvr_file->vm_ctx_handles);
 	vm_ctx = xa_load(&pvr_file->vm_ctx_handles, handle);
-	if (vm_ctx)
-		kref_get(&vm_ctx->ref_count);
-
+	pvr_vm_context_get(vm_ctx);
 	xa_unlock(&pvr_file->vm_ctx_handles);
 
 	return vm_ctx;