diff mbox series

drm/imagination: Use pvr_vm_context_get()

Message ID 72fa30a5-ddbf-4957-ad5c-5c941747be5c@imgtec.com (mailing list archive)
State New, archived
Headers show
Series drm/imagination: Use pvr_vm_context_get() | expand

Commit Message

Matt Coster Aug. 28, 2024, 1:09 p.m. UTC
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.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
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(-)

Comments

Frank Binns Aug. 30, 2024, 1:59 p.m. UTC | #1
On Wed, 2024-08-28 at 13:09 +0000, Matt Coster wrote:
> 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.
> 

Reviewed-by: Frank Binns <frank.binns@imgtec.com>

> Signed-off-by: Matt Coster <matt.coster@imgtec.com>
> 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(-)
> 
> diff --git a/drivers/gpu/drm/imagination/pvr_vm.c 
> b/drivers/gpu/drm/imagination/pvr_vm.c
> index e59517ba039e..ffd466509d0b 100644
> --- a/drivers/gpu/drm/imagination/pvr_vm.c
> +++ b/drivers/gpu/drm/imagination/pvr_vm.c
> @@ -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;
> -- 
> 2.46.0
> 
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/imagination/pvr_vm.c 
b/drivers/gpu/drm/imagination/pvr_vm.c
index e59517ba039e..ffd466509d0b 100644
--- a/drivers/gpu/drm/imagination/pvr_vm.c
+++ b/drivers/gpu/drm/imagination/pvr_vm.c
@@ -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;
-- 
2.46.0