Commit ddc3c087 authored by Michal Wajdeczko's avatar Michal Wajdeczko Committed by Lucas De Marchi

drm/xe: Use kstrdup while creating snapshot

There is no need to copy string step by step, use existing helper.

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://lore.kernel.org/r/20240112160652.893-1-michal.wajdeczko@intel.comSigned-off-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
parent 1c7531f5
...@@ -749,7 +749,6 @@ struct xe_hw_engine_snapshot * ...@@ -749,7 +749,6 @@ struct xe_hw_engine_snapshot *
xe_hw_engine_snapshot_capture(struct xe_hw_engine *hwe) xe_hw_engine_snapshot_capture(struct xe_hw_engine *hwe)
{ {
struct xe_hw_engine_snapshot *snapshot; struct xe_hw_engine_snapshot *snapshot;
int len;
if (!xe_hw_engine_is_valid(hwe)) if (!xe_hw_engine_is_valid(hwe))
return NULL; return NULL;
...@@ -759,11 +758,7 @@ xe_hw_engine_snapshot_capture(struct xe_hw_engine *hwe) ...@@ -759,11 +758,7 @@ xe_hw_engine_snapshot_capture(struct xe_hw_engine *hwe)
if (!snapshot) if (!snapshot)
return NULL; return NULL;
len = strlen(hwe->name) + 1; snapshot->name = kstrdup(hwe->name, GFP_ATOMIC);
snapshot->name = kzalloc(len, GFP_ATOMIC);
if (snapshot->name)
strscpy(snapshot->name, hwe->name, len);
snapshot->class = hwe->class; snapshot->class = hwe->class;
snapshot->logical_instance = hwe->logical_instance; snapshot->logical_instance = hwe->logical_instance;
snapshot->forcewake.domain = hwe->domain; snapshot->forcewake.domain = hwe->domain;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment