[PATCH] drm/amdgpu: properly initialize return value during CS

Christian König christian.koenig at amd.com
Tue Sep 20 12:41:27 UTC 2022


Am 20.09.22 um 14:38 schrieb Chen, Guchun:
> Looks using 'int r = 0;' is better?

No, local initialization is usually preferred in the kernel over 
initializing on declaration.

>   Anyway, this patch is: Reviewed-by: Guchun Chen <guchun.chen at amd.com>

Thanks,
Christian.

>
> Regards,
> Guchun
>
> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Christian König
> Sent: Tuesday, September 20, 2022 8:16 PM
> To: amd-gfx at lists.freedesktop.org
> Cc: Koenig, Christian <Christian.Koenig at amd.com>
> Subject: [PATCH] drm/amdgpu: properly initialize return value during CS
>
> The return value is no longer initialized before the loop because of moving code around.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>
> Fixes: 1ce5d2d0c831 ("drm/amdgpu: move entity selection and job init earlier during CS")
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index 58088c663125..e452350f462a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -1184,6 +1184,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
>   	/* If userptr are invalidated after amdgpu_cs_parser_bos(), return
>   	 * -EAGAIN, drmIoctl in libdrm will restart the amdgpu_cs_ioctl.
>   	 */
> +	r = 0;
>   	amdgpu_bo_list_for_each_userptr_entry(e, p->bo_list) {
>   		struct amdgpu_bo *bo = ttm_to_amdgpu_bo(e->tv.bo);
>   
> --
> 2.25.1
>



More information about the amd-gfx mailing list