Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe: Use kstrdup while creating snapshot
@ 2024-01-12 16:06 Michal Wajdeczko
  2024-01-12 16:10 ` ✓ CI.Patch_applied: success for " Patchwork
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Michal Wajdeczko @ 2024-01-12 16:06 UTC (permalink / raw)
  To: intel-xe; +Cc: Rodrigo Vivi

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>
---
 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


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

end of thread, other threads:[~2024-01-12 21:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH] " Rodrigo Vivi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox