All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: properly initialize return value during CS
@ 2022-09-20 12:15 Christian König
  2022-09-20 12:38 ` Chen, Guchun
  0 siblings, 1 reply; 3+ messages in thread
From: Christian König @ 2022-09-20 12:15 UTC (permalink / raw)
  To: amd-gfx; +Cc: Christian König

The return value is no longer initialized before the loop because of
moving code around.

Signed-off-by: Christian König <christian.koenig@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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] drm/amdgpu: properly initialize return value during CS
  2022-09-20 12:15 [PATCH] drm/amdgpu: properly initialize return value during CS Christian König
@ 2022-09-20 12:38 ` Chen, Guchun
  2022-09-20 12:41   ` Christian König
  0 siblings, 1 reply; 3+ messages in thread
From: Chen, Guchun @ 2022-09-20 12:38 UTC (permalink / raw)
  To: Christian König, amd-gfx; +Cc: Koenig, Christian

Looks using 'int r = 0;' is better? Anyway, this patch is: Reviewed-by: Guchun Chen <guchun.chen@amd.com>

Regards,
Guchun

-----Original Message-----
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Christian König
Sent: Tuesday, September 20, 2022 8:16 PM
To: amd-gfx@lists.freedesktop.org
Cc: Koenig, Christian <Christian.Koenig@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@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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdgpu: properly initialize return value during CS
  2022-09-20 12:38 ` Chen, Guchun
@ 2022-09-20 12:41   ` Christian König
  0 siblings, 0 replies; 3+ messages in thread
From: Christian König @ 2022-09-20 12:41 UTC (permalink / raw)
  To: Chen, Guchun, Christian König, amd-gfx

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@amd.com>

Thanks,
Christian.

>
> Regards,
> Guchun
>
> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Christian König
> Sent: Tuesday, September 20, 2022 8:16 PM
> To: amd-gfx@lists.freedesktop.org
> Cc: Koenig, Christian <Christian.Koenig@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@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
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-20 12:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-20 12:15 [PATCH] drm/amdgpu: properly initialize return value during CS Christian König
2022-09-20 12:38 ` Chen, Guchun
2022-09-20 12:41   ` Christian König

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.