Skip to contentSkip to conversation

drm/amd/powerplay: fix variable type errors in smu_v11_0_setup_pptable

PATCH In review Wang, Kevin(Yang) 2 participants 2 messages Aug 19, 2019 – Aug 20, 2019 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/powerplay: fix variable type errors in smu_v11_0_setup_pptable

fix size type errors, from uint32_t to uint16_t. it will cause only initializes the highest 16 bits in smu_get_atom_data_table function.

---
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +3 -1
index b69632fe856b..e9a022447ac1 100644
@@ -368,6 +368,7 @@ static int smu_v11_0_setup_pptable(struct smu_context *smu)
 	const struct smc_firmware_header_v1_0 *hdr;
 	int ret, index;
 	uint32_t size;
+	uint16_t atom_table_size;
 	uint8_t frev, crev;
 	void *table;
 	uint16_t version_major, version_minor;
@@ -395,10 +396,11 @@ static int smu_v11_0_setup_pptable(struct smu_context *smu)
 		index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
 						    powerplayinfo);
 
-		ret = smu_get_atom_data_table(smu, index, (uint16_t *)&size, &frev, &crev,
+		ret = smu_get_atom_data_table(smu, index, &atom_table_size, &frev, &crev,
 					      (uint8_t **)&table);
 		if (ret)
 			return ret;
+		size = atom_table_size;
 	}
 
 	if (!smu->smu_table.power_play_table)
Signature · 6 lines
2.22.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Please add the followings to the description part. With that added, the patch is Reviewed-by: Evan Quan <[email protected]> "
This fixes the following static checker warning.
drivers/gpu/drm/amd/amdgpu/../powerplay/smu_v11_0.c:390 smu_v11_0_setup_pptable()
warn: passing casted pointer '&size' to 'smu_get_atom_data_table()' 32 vs 16.
"

Quoted 54 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Wang, Kevin(Yang)
Sent: Monday, August 19, 2019 11:47 PM
To: [email protected]
Cc: Wang, Kevin(Yang) <[email protected]>; [email protected]
Subject: [PATCH] drm/amd/powerplay: fix variable type errors in smu_v11_0_setup_pptable

fix size type errors, from uint32_t to uint16_t. it will cause only initializes the highest 16 bits in smu_get_atom_data_table function.

---
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +1 -0
index b69632fe856b..e9a022447ac1 100644
@@ -368,6 +368,7 @@ static int smu_v11_0_setup_pptable(struct
 smu_context *smu)
 	const struct smc_firmware_header_v1_0 *hdr;
 	int ret, index;
 	uint32_t size;
+	uint16_t atom_table_size;
 	uint8_t frev, crev;
 	void *table;
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +2 -2
 	uint16_t version_major, version_minor;
@@ -395,10 +396,11 @@ static int smu_v11_0_setup_pptable(struct
 smu_context *smu)
 		index =
 get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
 						    powerplayinfo);
 
-		ret = smu_get_atom_data_table(smu, index, (uint16_t
 *)&size, &frev, &crev,
+		ret = smu_get_atom_data_table(smu, index,
 &atom_table_size, &frev, &crev,
 					      (uint8_t **)&table);
 		if (ret)
 			return ret;
+		size = atom_table_size;
 	}
 
 	if (!smu->smu_table.power_play_table)
--

2.22.0

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx