Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH] drm/xe: Use kstrdup while creating snapshot
Date: Fri, 12 Jan 2024 16:11:57 -0500	[thread overview]
Message-ID: <ZaGrHbOqyLNz5ws9@intel.com> (raw)
In-Reply-To: <20240112160652.893-1-michal.wajdeczko@intel.com>

On Fri, Jan 12, 2024 at 05:06:52PM +0100, Michal Wajdeczko wrote:
> There is no need to copy string step by step, use existing helper.
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  drivers/gpu/drm/xe/xe_hw_engine.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_hw_engine.c b/drivers/gpu/drm/xe/xe_hw_engine.c
> index e279ef6c527c..3aaab507f37f 100644
> --- a/drivers/gpu/drm/xe/xe_hw_engine.c
> +++ b/drivers/gpu/drm/xe/xe_hw_engine.c
> @@ -749,7 +749,6 @@ struct xe_hw_engine_snapshot *
>  xe_hw_engine_snapshot_capture(struct xe_hw_engine *hwe)
>  {
>  	struct xe_hw_engine_snapshot *snapshot;
> -	int len;
>  
>  	if (!xe_hw_engine_is_valid(hwe))
>  		return NULL;
> @@ -759,11 +758,7 @@ xe_hw_engine_snapshot_capture(struct xe_hw_engine *hwe)
>  	if (!snapshot)
>  		return NULL;
>  
> -	len = strlen(hwe->name) + 1;
> -	snapshot->name = kzalloc(len, GFP_ATOMIC);
> -	if (snapshot->name)
> -		strscpy(snapshot->name, hwe->name, len);
> -
> +	snapshot->name = kstrdup(hwe->name, GFP_ATOMIC);
>  	snapshot->class = hwe->class;
>  	snapshot->logical_instance = hwe->logical_instance;
>  	snapshot->forcewake.domain = hwe->domain;
> 
> base-commit: 7a20187068bed91b523795a18219e570f1e84eb1
> -- 
> 2.25.1
> 

      parent reply	other threads:[~2024-01-12 21:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-12 16:06 [PATCH] drm/xe: Use kstrdup while creating snapshot Michal Wajdeczko
2024-01-12 16:10 ` ✓ CI.Patch_applied: success for " Patchwork
2024-01-12 16:10 ` ✓ CI.checkpatch: " Patchwork
2024-01-12 16:11 ` ✓ CI.KUnit: " Patchwork
2024-01-12 16:18 ` ✓ CI.Build: " Patchwork
2024-01-12 16:18 ` ✓ CI.Hooks: " Patchwork
2024-01-12 16:20 ` ✓ CI.checksparse: " Patchwork
2024-01-12 16:43 ` ✓ CI.BAT: " Patchwork
2024-01-12 21:11 ` Rodrigo Vivi [this message]

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=ZaGrHbOqyLNz5ws9@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=michal.wajdeczko@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox