Skip to contentSkip to conversation

drm/amdgpu: fix uninitialized scalar variable warning

PATCH In review Tim Huang 2 participants 4 messages Apr 26, 2024 – Apr 30, 2024

Subsystems (2)
lore
Share & tools
lore

Tim Huang

author
#0 lore raw

PATCH 1/1 drm/amdgpu: fix uninitialized scalar variable warning

Clear warning that field bp is uninitialized when
calling amdgpu_virt_ras_add_bps.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +2 -0
index 54ab51a4ada7..a2f15edfe812 100644
@@ -395,6 +395,8 @@ static void amdgpu_virt_add_bad_page(struct amdgpu_device *adev,
 	else
 		vram_usage_va = adev->mman.drv_vram_usage_va;
 
+	memset(&bp, 0, sizeof(struct eeprom_table_record));
+
 	if (bp_block_size) {
 		bp_cnt = bp_block_size / sizeof(uint64_t);
 		for (bp_idx = 0; bp_idx < bp_cnt; bp_idx++) {
Signature · 1 line
2.39.2
author
#1 lore raw

[Public]

Ping ...

Quoted 33 lines

-----Original Message-----
From: Huang, Tim <[email protected]>
Sent: Friday, April 26, 2024 9:14 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>
Subject: [PATCH] drm/amdgpu: fix uninitialized scalar variable warning

Clear warning that field bp is uninitialized when calling amdgpu_virt_ras_add_bps.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +2 -0
index 54ab51a4ada7..a2f15edfe812 100644
@@ -395,6 +395,8 @@ static void amdgpu_virt_add_bad_page(struct
 amdgpu_device *adev,
      else
              vram_usage_va = adev->mman.drv_vram_usage_va;
 
+     memset(&bp, 0, sizeof(struct eeprom_table_record));
+
      if (bp_block_size) {
              bp_cnt = bp_block_size / sizeof(uint64_t);
              for (bp_idx = 0; bp_idx < bp_cnt; bp_idx++) {

--
2.39.2

Reviewed-by
#2 lore raw

[Public]

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Huang, Tim
Sent: Tuesday, April 30, 2024 11:32 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: fix uninitialized scalar variable warning

[Public]

[Public]

Ping ...

Quoted 22 lines

-----Original Message-----
From: Huang, Tim <[email protected]>
Sent: Friday, April 26, 2024 9:14 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>
Subject: [PATCH] drm/amdgpu: fix uninitialized scalar variable warning

Clear warning that field bp is uninitialized when calling amdgpu_virt_ras_add_bps.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +0 -0
index 54ab51a4ada7..a2f15edfe812 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c static void amdgpu_virt_add_bad_page(struct · line 399

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +1 -0
@@ -395,6 +395,8 @@ static void amdgpu_virt_add_bad_page(struct
 amdgpu_device *adev,
      else
              vram_usage_va = adev->mman.drv_vram_usage_va;
 
+     memset(&bp, 0, sizeof(struct eeprom_table_record));

[Kevin]:

It is better to change code to "sizeof (bp)".

Best Regards,
Kevin

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +1 -0
+
      if (bp_block_size) {
              bp_cnt = bp_block_size / sizeof(uint64_t);
              for (bp_idx = 0; bp_idx < bp_cnt; bp_idx++) {

--
2.39.2

author
#3 lore raw

[Public]

Quoted 50 lines

-----Original Message-----
From: Wang, Yang(Kevin) <[email protected]>
Sent: Tuesday, April 30, 2024 12:14 PM
To: Huang, Tim <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: fix uninitialized scalar variable warning

[Public]

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Huang, Tim
Sent: Tuesday, April 30, 2024 11:32 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: fix uninitialized scalar variable warning

[Public]

[Public]

Ping ...

Quoted 26 lines

-----Original Message-----
From: Huang, Tim <[email protected]>
Sent: Friday, April 26, 2024 9:14 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>
Subject: [PATCH] drm/amdgpu: fix uninitialized scalar variable warning

Clear warning that field bp is uninitialized when calling amdgpu_virt_ras_add_bps.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +0 -0
index 54ab51a4ada7..a2f15edfe812 100644
@@ -395,6 +395,8 @@ static void amdgpu_virt_add_bad_page(struct
 amdgpu_device *adev,
      else
              vram_usage_va = adev->mman.drv_vram_usage_va;
 
Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c static void amdgpu_virt_add_bad_page(struct amdgpu_device *adev, · line 398

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +1 -0
+     memset(&bp, 0, sizeof(struct eeprom_table_record));

[Kevin]:

It is better to change code to "sizeof (bp)".

Yes, agree, will change to this. Thanks.

Tim

Quoted 12 lines

Best Regards,
Kevin

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +1 -0
+
      if (bp_block_size) {
              bp_cnt = bp_block_size / sizeof(uint64_t);
              for (bp_idx = 0; bp_idx < bp_cnt; bp_idx++) {

--
2.39.2