drm/amdgpu: properly initialize return value during CS
Subsystems (2)
PATCH 1/1 drm/amdgpu: properly initialize return value during CS
The return value is no longer initialized before the loop because of moving code around.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -0
@@ -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);
Signature · 1 line
2.25.1
Looks using 'int r = 0;' is better? Anyway, this patch is: Reviewed-by: Guchun Chen <[email protected]>
Regards,
Guchun
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Christian König
Sent: Tuesday, September 20, 2022 8:16 PM
To: [email protected]
Cc: Koenig, Christian <[email protected]>
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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -0
@@ -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
Christian König
maintainerAm 20.09.22 um 14:38 schrieb Chen, Guchun:
Quoted 1 line
Looks using 'int r = 0;' is better?
No, local initialization is usually preferred in the kernel over initializing on declaration.
Quoted 1 line
Anyway, this patch is: Reviewed-by: Guchun Chen <[email protected]>
Thanks,
Christian.
Quoted 34 lines
Regards,
Guchun-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Christian König
Sent: Tuesday, September 20, 2022 8:16 PM
To: [email protected]
Cc: Koenig, Christian <[email protected]>
Subject: [PATCH] drm/amdgpu: properly initialize return value during CSThe return value is no longer initialized before the loop because of moving code around.
Signed-off-by Christian König <[email protected]>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(+)drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1
-1@@ -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