[PATCH] drm/amdgpu: Fix uninitalized variable in kgd2kfd_device_init
Alex Deucher
alexdeucher at gmail.com
Fri May 19 16:56:17 UTC 2023
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
On Fri, May 19, 2023 at 1:17 AM Srinivasan Shanmugam
<srinivasan.shanmugam at amd.com> wrote:
>
> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_device.c:613:4: error: variable 'num_xcd' is uninitialized when used here [-Werror,-Wuninitialized]
> num_xcd, kfd->adev->gfx.num_xcc_per_xcp);
> ^~~~~~~
> include/linux/dev_printk.h:144:65: note: expanded from macro 'dev_err'
> dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
> ^~~~~~~~~~~
> include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
> _p_func(dev, fmt, ##__VA_ARGS__); \
> ^~~~~~~~~~~
> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_device.c:597:13: note: initialize the variable 'num_xcd' to silence this warning
> int num_xcd, partition_mode;
> ^
> = 0
> 1 error generated.
>
> Cc: Luben Tuikov <luben.tuikov at amd.com>
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Cc: Christian König <christian.koenig at amd.com>
> Cc: Felix Kuehling <Felix.Kuehling at amd.com>
> Cc: Mukul Joshi <mukul.joshi at amd.com>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam at amd.com>
> ---
> drivers/gpu/drm/amd/amdkfd/kfd_device.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> index 986543a000bf..e92b93b2c14c 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> @@ -594,7 +594,7 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
> struct kfd_node *node;
> uint32_t first_vmid_kfd, last_vmid_kfd, vmid_num_kfd;
> unsigned int max_proc_per_quantum;
> - int num_xcd, partition_mode;
> + int partition_mode;
> int xcp_idx;
>
> kfd->mec_fw_version = amdgpu_amdkfd_get_fw_version(kfd->adev,
> @@ -609,8 +609,8 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
>
> if (kfd->num_nodes == 0) {
> dev_err(kfd_device,
> - "KFD num nodes cannot be 0, GC inst: %d, num_xcc_in_node: %d\n",
> - num_xcd, kfd->adev->gfx.num_xcc_per_xcp);
> + "KFD num nodes cannot be 0, num_xcc_in_node: %d\n",
> + kfd->adev->gfx.num_xcc_per_xcp);
> goto out;
> }
>
> --
> 2.25.1
>
More information about the amd-gfx
mailing list