[Intel-xe] [PATCH 1/2] drm/xe: Fix error path in xe_guc_pc_gucrc_disable()

Matthew Brost matthew.brost at intel.com
Fri Aug 4 00:29:00 UTC 2023


On Thu, Aug 03, 2023 at 04:42:08PM -0700, Lucas De Marchi wrote:
> Make sure to always call xe_device_mem_access_put(), even on error.
> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>

Reviewed-by: Matthew Brost <matthew.brost at intel.com>

> ---
>  drivers/gpu/drm/xe/xe_guc_pc.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c b/drivers/gpu/drm/xe/xe_guc_pc.c
> index 91a3967fd799..19d743f92f43 100644
> --- a/drivers/gpu/drm/xe/xe_guc_pc.c
> +++ b/drivers/gpu/drm/xe/xe_guc_pc.c
> @@ -745,25 +745,27 @@ static int pc_adjust_requested_freq(struct xe_guc_pc *pc)
>  int xe_guc_pc_gucrc_disable(struct xe_guc_pc *pc)
>  {
>  	struct xe_gt *gt = pc_to_gt(pc);
> -	int ret;
> +	int ret = 0;
>  
>  	xe_device_mem_access_get(pc_to_xe(pc));
>  
>  	ret = pc_action_setup_gucrc(pc, XE_GUCRC_HOST_CONTROL);
>  	if (ret)
> -		return ret;
> +		goto out;
>  
>  	ret = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
>  	if (ret)
> -		return ret;
> +		goto out;
>  
>  	xe_mmio_write32(gt, PG_ENABLE, 0);
>  	xe_mmio_write32(gt, RC_CONTROL, 0);
>  	xe_mmio_write32(gt, RC_STATE, 0);
>  
>  	XE_WARN_ON(xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL));
> +
> +out:
>  	xe_device_mem_access_put(pc_to_xe(pc));
> -	return 0;
> +	return ret;
>  }
>  
>  static void pc_init_pcode_freq(struct xe_guc_pc *pc)
> -- 
> 2.40.1
> 


More information about the Intel-xe mailing list