From: Lijo Lazar Date: Fri, 3 May 2024 13:55:48 +0000 (+0530) Subject: drm/amd/amdxcp: Fix warnings X-Git-Tag: microblaze-v6.13~537^2~32^2~313 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=a641c25fa45c95b4eaa036beba4624956a8fd461;p=linux-2.6-microblaze.git drm/amd/amdxcp: Fix warnings Range of possible values of pdev_num is 0-63. Use int8_t as data type. That also fixes below warnings: >> drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c:59:58: warning: '%d' >> directive output may be truncated writing between 1 and 11 bytes into >> a region of size 9 [-Wformat-truncation=] 59 | snprintf(dev_name, sizeof(dev_name), "amdgpu_xcp_%d", pdev_num); | ^~ drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c:59:46: note: directive argument in the range [-2147483648, 63] 59 | snprintf(dev_name, sizeof(dev_name), "amdgpu_xcp_%d", pdev_num); | ^~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c:59:9: note: 'snprintf' output between 13 and 23 bytes into a destination of size 20 59 | snprintf(dev_name, sizeof(dev_name), "amdgpu_xcp_%d", pdev_num); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fixes: 97d814fe4f69 ("drm/amd/amdxcp: Use unique name for partition dev") Signed-off-by: Lijo Lazar Reported-by: kernel test robot Reviewed-by: Hawking Zhang Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c b/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c index b4131053b31b..faed84172dd4 100644 --- a/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c +++ b/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c @@ -43,7 +43,7 @@ static const struct drm_driver amdgpu_xcp_driver = { .minor = 0, }; -static int pdev_num; +static int8_t pdev_num; static struct xcp_device *xcp_dev[MAX_XCP_PLATFORM_DEVICE]; int amdgpu_xcp_drm_dev_alloc(struct drm_device **ddev)