[PATCH] drm/amd/amdgpu: Fix an uninitialized variable
Srinivasan Shanmugam
srinivasan.shanmugam at amd.com
Mon Jan 9 08:29:16 UTC 2023
CC drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.o
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c:217:71: error: variable 'i' is uninitialized when used here [-Werror,-Wuninitialized]
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s%d.bin", ucode_prefix, i);
^
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c:207:16: note: initialize the variable 'i' to silence this warning
int err = 0, i;
^
= 0
Initialize the variable 'i'.
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam at amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
index 0e1e2521fe25a..64f2b855a378a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
@@ -204,7 +204,7 @@ int amdgpu_sdma_init_microcode(struct amdgpu_device *adev,
{
struct amdgpu_firmware_info *info = NULL;
const struct common_firmware_header *header = NULL;
- int err = 0, i;
+ int err = 0, i = 0;
const struct sdma_firmware_header_v2_0 *sdma_hdr;
uint16_t version_major;
char ucode_prefix[30];
--
2.25.1
More information about the amd-gfx
mailing list