Skip to contentSkip to conversation

drm/amd/pm: fix the uninitialized scalar variable waring

PATCH Superseded Jesse Zhang 3 participants 3 messages Apr 26, 2024 – Apr 28, 2024

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/amd/pm: fix the uninitialized scalar variable waring

Initialize variable size before calling hwmgr->hwmgr_func->iread_sensor, such as smu7_read_sensor.

---
 drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +1 -0
index 5fb21a0508cd..ec2b6d0674ed 100644
@@ -102,6 +102,7 @@ static void pp_swctf_delayed_work_handler(struct work_struct *work)
 	uint32_t gpu_temperature, size;
 	int ret;
 
+	size = sizeof(gpu_temperature);
 	/*
 	 * If the hotspot/edge temperature is confirmed as below SW CTF setting point
 	 * after the delay enforced, nothing will be done.
Signature · 1 line
2.25.1
Reviewed-by on v1 1/2
#1 lore raw

[AMD Official Use Only - General]

This patch is,

Best Regards,
Tim Huang

Quoted 35 lines

-----Original Message-----
From: Jesse Zhang <[email protected]>
Sent: Friday, April 26, 2024 5:52 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 1/2] drm/amd/pm: fix the uninitialized scalar variable waring

Initialize variable size before calling hwmgr->hwmgr_func->iread_sensor, such as smu7_read_sensor.

---
 drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +1 -0
index 5fb21a0508cd..ec2b6d0674ed 100644
@@ -102,6 +102,7 @@ static void pp_swctf_delayed_work_handler(struct
 work_struct *work)
      uint32_t gpu_temperature, size;
      int ret;
 
+     size = sizeof(gpu_temperature);
      /*
       * If the hotspot/edge temperature is confirmed as below SW CTF

setting point
* after the delay enforced, nothing will be done.
--
2.25.1

Reviewed-by on v1 1/2
#2 lore raw
In reply to Jesse Zhang

[AMD Official Use Only - General]

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jesse Zhang
Sent: Friday, April 26, 2024 5:52 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 1/2] drm/amd/pm: fix the uninitialized scalar variable waring

Initialize variable size before calling hwmgr->hwmgr_func->iread_sensor, such as smu7_read_sensor.

---
 drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +1 -0
index 5fb21a0508cd..ec2b6d0674ed 100644
@@ -102,6 +102,7 @@ static void pp_swctf_delayed_work_handler(struct work_struct *work)
        uint32_t gpu_temperature, size;
        int ret;
 
+       size = sizeof(gpu_temperature);
 

[Kevin]:
You can directly initialize during the declaration phase to avoid reassignment.

With fixed, the patch is

Best Regards,
Kevin
/*
* If the hotspot/edge temperature is confirmed as below SW CTF setting point
* after the delay enforced, nothing will be done.
--
2.25.1