All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhong jiang <zhongjiang@huawei.com>
To: airlied@linux.ie, alexander.deucher@amd.com
Cc: oded.gabbay@gmail.com, christian.koenig@amd.com,
	David1.Zhou@amd.com, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org,
	Harry Wentland <harry.wentland@amd.com>
Subject: Re: [PATCH] drm: amd: Use kmemdup instead of duplicating its function
Date: Fri, 21 Sep 2018 22:13:09 +0800	[thread overview]
Message-ID: <5BA4FC75.7040902@huawei.com> (raw)
In-Reply-To: <1537284932-62278-1-git-send-email-zhongjiang@huawei.com>

+cc  amd-gfx@lists.freedesktop.org

Thanks,
zhong jiang

On 2018/9/18 23:35, zhong jiang wrote:
> kmemdup has implemented the function that kmalloc() + memcpy().
> We prefer to kmemdup rather than code opened implementation.
>
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
> index ee49960..8ddd585 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
> @@ -747,12 +747,10 @@ int kfd_create_crat_image_acpi(void **crat_image, size_t *size)
>  		return -ENODATA;
>  	}
>  
> -	pcrat_image = kmalloc(crat_table->length, GFP_KERNEL);
> +	pcrat_image = kmemdup(crat_table, crat_table->length, GFP_KERNEL);
>  	if (!pcrat_image)
>  		return -ENOMEM;
>  
> -	memcpy(pcrat_image, crat_table, crat_table->length);
> -
>  	*crat_image = pcrat_image;
>  	*size = crat_table->length;
>  

WARNING: multiple messages have this Message-ID (diff)
From: zhong jiang <zhongjiang@huawei.com>
To: <airlied@linux.ie>, <alexander.deucher@amd.com>
Cc: <oded.gabbay@gmail.com>, <christian.koenig@amd.com>,
	<David1.Zhou@amd.com>, <dri-devel@lists.freedesktop.org>,
	<linux-kernel@vger.kernel.org>, <amd-gfx@lists.freedesktop.org>,
	"Harry Wentland" <harry.wentland@amd.com>
Subject: Re: [PATCH] drm: amd: Use kmemdup instead of duplicating its function
Date: Fri, 21 Sep 2018 22:13:09 +0800	[thread overview]
Message-ID: <5BA4FC75.7040902@huawei.com> (raw)
In-Reply-To: <1537284932-62278-1-git-send-email-zhongjiang@huawei.com>

+cc  amd-gfx@lists.freedesktop.org

Thanks,
zhong jiang

On 2018/9/18 23:35, zhong jiang wrote:
> kmemdup has implemented the function that kmalloc() + memcpy().
> We prefer to kmemdup rather than code opened implementation.
>
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
> index ee49960..8ddd585 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
> @@ -747,12 +747,10 @@ int kfd_create_crat_image_acpi(void **crat_image, size_t *size)
>  		return -ENODATA;
>  	}
>  
> -	pcrat_image = kmalloc(crat_table->length, GFP_KERNEL);
> +	pcrat_image = kmemdup(crat_table, crat_table->length, GFP_KERNEL);
>  	if (!pcrat_image)
>  		return -ENOMEM;
>  
> -	memcpy(pcrat_image, crat_table, crat_table->length);
> -
>  	*crat_image = pcrat_image;
>  	*size = crat_table->length;
>  



  reply	other threads:[~2018-09-21 14:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-18 15:35 [PATCH] drm: amd: Use kmemdup instead of duplicating its function zhong jiang
2018-09-18 15:35 ` zhong jiang
2018-09-21 14:13 ` zhong jiang [this message]
2018-09-21 14:13   ` zhong jiang
2018-10-11 22:37 ` Felix Kuehling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5BA4FC75.7040902@huawei.com \
    --to=zhongjiang@huawei.com \
    --cc=David1.Zhou@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oded.gabbay@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.