All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/powerplay: fix variable type errors in smu_v11_0_setup_pptable
@ 2019-08-19 15:47 Wang, Kevin(Yang)
       [not found] ` <20190819154701.17647-1-kevin1.wang-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Wang, Kevin(Yang) @ 2019-08-19 15:47 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Wang, Kevin(Yang), dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA

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.

Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
index b69632fe856b..e9a022447ac1 100644
--- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
@@ -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)
-- 
2.22.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [PATCH] drm/amd/powerplay: fix variable type errors in smu_v11_0_setup_pptable
       [not found] ` <20190819154701.17647-1-kevin1.wang-5C7GfCeVMHo@public.gmane.org>
@ 2019-08-20  1:47   ` Quan, Evan
  0 siblings, 0 replies; 2+ messages in thread
From: Quan, Evan @ 2019-08-20  1:47 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Wang, Kevin(Yang), dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA

Please add the followings to the description part. With that added, the patch is Reviewed-by: Evan Quan <evan.quan@amd.com>
"
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.
"

> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of
> Wang, Kevin(Yang)
> Sent: Monday, August 19, 2019 11:47 PM
> To: amd-gfx@lists.freedesktop.org
> Cc: Wang, Kevin(Yang) <Kevin1.Wang@amd.com>;
> dan.carpenter@oracle.com
> 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.
> 
> Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
> b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
> index b69632fe856b..e9a022447ac1 100644
> --- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
> +++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
> @@ -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)
> --
> 2.22.0
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-20  1:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-19 15:47 [PATCH] drm/amd/powerplay: fix variable type errors in smu_v11_0_setup_pptable Wang, Kevin(Yang)
     [not found] ` <20190819154701.17647-1-kevin1.wang-5C7GfCeVMHo@public.gmane.org>
2019-08-20  1:47   ` Quan, Evan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.