RE: [PATCH 8/8] drm/amd/amdxcp: assert XCP platform device names

2026-05-27 Thread Zhang, Hawking
AMD General

Series is

Reviewed-by: Hawking Zhang 

Regards,
Hawking
-Original Message-
From: Li, Candice 
Sent: Thursday, May 28, 2026 12:34 PM
To: [email protected]
Cc: Zhang, Hawking ; Zhou1, Tao ; 
Yang, Stanley ; Chai, Thomas ; Li, 
Candice 
Subject: [PATCH 8/8] drm/amd/amdxcp: assert XCP platform device names

Replace the fixed stack buffer and static_assert with kasprintf() so platform 
device names are always fully formatted.

Signed-off-by: Candice Li 
---
 drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c 
b/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c
index 44009aa8216ed0..995cae6be144a0 100644
--- a/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c
+++ b/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 

@@ -52,7 +53,7 @@ int amdgpu_xcp_drm_dev_alloc(struct drm_device **ddev)  {
struct platform_device *pdev;
struct xcp_device *pxcp_dev;
-   char dev_name[20];
+   char *dev_name;
int ret, i;

guard(mutex)(&xcp_mutex);
@@ -68,8 +69,12 @@ int amdgpu_xcp_drm_dev_alloc(struct drm_device **ddev)
if (i >= MAX_XCP_PLATFORM_DEVICE)
return -ENODEV;

-   snprintf(dev_name, sizeof(dev_name), "amdgpu_xcp_%d", i);
+   dev_name = kasprintf(GFP_KERNEL, "amdgpu_xcp_%d", i);
+   if (!dev_name)
+   return -ENOMEM;
+
pdev = platform_device_register_simple(dev_name, -1, NULL, 0);
+   kfree(dev_name);
if (IS_ERR(pdev))
return PTR_ERR(pdev);

--
2.25.1



[PATCH 8/8] drm/amd/amdxcp: assert XCP platform device names

2026-05-27 Thread Candice Li
Replace the fixed stack buffer and static_assert with kasprintf() so
platform device names are always fully formatted.

Signed-off-by: Candice Li 
---
 drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c 
b/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c
index 44009aa8216ed0..995cae6be144a0 100644
--- a/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c
+++ b/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -52,7 +53,7 @@ int amdgpu_xcp_drm_dev_alloc(struct drm_device **ddev)
 {
struct platform_device *pdev;
struct xcp_device *pxcp_dev;
-   char dev_name[20];
+   char *dev_name;
int ret, i;
 
guard(mutex)(&xcp_mutex);
@@ -68,8 +69,12 @@ int amdgpu_xcp_drm_dev_alloc(struct drm_device **ddev)
if (i >= MAX_XCP_PLATFORM_DEVICE)
return -ENODEV;
 
-   snprintf(dev_name, sizeof(dev_name), "amdgpu_xcp_%d", i);
+   dev_name = kasprintf(GFP_KERNEL, "amdgpu_xcp_%d", i);
+   if (!dev_name)
+   return -ENOMEM;
+
pdev = platform_device_register_simple(dev_name, -1, NULL, 0);
+   kfree(dev_name);
if (IS_ERR(pdev))
return PTR_ERR(pdev);
 
-- 
2.25.1