[PATCH v2 3/3] drm/xe/query: Tidy up error EFAULT returns

Matt Roper matthew.d.roper at intel.com
Fri Oct 11 21:17:58 UTC 2024


On Thu, Oct 10, 2024 at 08:56:18PM -0700, Lucas De Marchi wrote:
> Move the error handling together in a single branch since all of them
> are doing similar thing and return the same error.
> 
> Reviewed-by: Sai Teja Pottumuttu <sai.teja.pottumuttu at intel.com>
> Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>

Reviewed-by: Matt Roper <matthew.d.roper at intel.com>

> ---
>  drivers/gpu/drm/xe/xe_query.c | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c
> index 69307ff4146a1..5093a243e9fe1 100644
> --- a/drivers/gpu/drm/xe/xe_query.c
> +++ b/drivers/gpu/drm/xe/xe_query.c
> @@ -163,16 +163,10 @@ query_engine_cycles(struct xe_device *xe,
>  		resp.width = 36;
>  
>  	/* Only write to the output fields of user query */
> -	if (put_user(resp.cpu_timestamp, &query_ptr->cpu_timestamp))
> -		return -EFAULT;
> -
> -	if (put_user(resp.cpu_delta, &query_ptr->cpu_delta))
> -		return -EFAULT;
> -
> -	if (put_user(resp.engine_cycles, &query_ptr->engine_cycles))
> -		return -EFAULT;
> -
> -	if (put_user(resp.width, &query_ptr->width))
> +	if (put_user(resp.cpu_timestamp, &query_ptr->cpu_timestamp) ||
> +	    put_user(resp.cpu_delta, &query_ptr->cpu_delta) ||
> +	    put_user(resp.engine_cycles, &query_ptr->engine_cycles) ||
> +	    put_user(resp.width, &query_ptr->width))
>  		return -EFAULT;
>  
>  	return 0;
> -- 
> 2.46.2
> 

-- 
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation


More information about the Intel-xe mailing list