2017-08-29 19:03:53

by Himanshu Jha

[permalink] [raw]
Subject: [PATCH] drm/amdkfd: remove memset before memcpy

calling memcpy immediately after memset with the same region of memory
makes memset redundant.

Signed-off-by: Himanshu Jha <[email protected]>
---
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
index 1cae95e..03bec76 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
@@ -143,7 +143,6 @@ int pqm_create_queue(struct process_queue_manager *pqm,
int num_queues = 0;
struct queue *cur;

- memset(&q_properties, 0, sizeof(struct queue_properties));
memcpy(&q_properties, properties, sizeof(struct queue_properties));
q = NULL;
kq = NULL;
--
2.7.4


2017-09-02 12:40:32

by Oded Gabbay

[permalink] [raw]
Subject: Re: [PATCH] drm/amdkfd: remove memset before memcpy

On Tue, Aug 29, 2017 at 10:03 PM, Himanshu Jha
<[email protected]> wrote:
> calling memcpy immediately after memset with the same region of memory
> makes memset redundant.
>
> Signed-off-by: Himanshu Jha <[email protected]>
> ---
> drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> index 1cae95e..03bec76 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> @@ -143,7 +143,6 @@ int pqm_create_queue(struct process_queue_manager *pqm,
> int num_queues = 0;
> struct queue *cur;
>
> - memset(&q_properties, 0, sizeof(struct queue_properties));
> memcpy(&q_properties, properties, sizeof(struct queue_properties));
> q = NULL;
> kq = NULL;
> --
> 2.7.4
>

Thanks!
Applied to amdkfd -next tree

Oded