All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] drm/amd/powerplay: initialize a variable before using it
@ 2017-09-03 12:00 Nicolas Iooss
  2017-11-04 12:21   ` Nicolas Iooss
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Iooss @ 2017-09-03 12:00 UTC (permalink / raw)
  To: Alex Deucher, Christian König, David Airlie
  Cc: amd-gfx, dri-devel, linux-kernel, Nicolas Iooss

Function vega10_apply_state_adjust_rules() only initializes
stable_pstate_sclk_dpm_percentage when
data->registry_data.stable_pstate_sclk_dpm_percentage is not between 1
and 100. The variable is then used to compute stable_pstate_sclk, which
therefore uses an uninitialized value.

Fix this by initializing stable_pstate_sclk_dpm_percentage to
data->registry_data.stable_pstate_sclk_dpm_percentage.

This issue has been found while building the kernel with clang. The
compiler reported a -Wsometimes-uninitialized warning.

Fixes: f83a9991648b ("drm/amd/powerplay: add Vega10 powerplay support (v5)")
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
index 197174e562d2..c8d28f78cd47 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
@@ -3043,6 +3043,8 @@ static int vega10_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
 
 	if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
 			PHM_PlatformCaps_StablePState)) {
+		stable_pstate_sclk_dpm_percentage =
+			data->registry_data.stable_pstate_sclk_dpm_percentage;
 		PP_ASSERT_WITH_CODE(
 			data->registry_data.stable_pstate_sclk_dpm_percentage >= 1 &&
 			data->registry_data.stable_pstate_sclk_dpm_percentage <= 100,
-- 
2.14.1

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

* Re: [PATCH 1/1] drm/amd/powerplay: initialize a variable before using it
  2017-09-03 12:00 [PATCH 1/1] drm/amd/powerplay: initialize a variable before using it Nicolas Iooss
@ 2017-11-04 12:21   ` Nicolas Iooss
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Iooss @ 2017-11-04 12:21 UTC (permalink / raw)
  To: Alex Deucher, Christian König, David Airlie
  Cc: amd-gfx, ML dri-devel, linux-kernel

On Sun, Sep 3, 2017 at 2:00 PM, Nicolas Iooss
<nicolas.iooss_linux@m4x.org> wrote:
>
> Function vega10_apply_state_adjust_rules() only initializes
> stable_pstate_sclk_dpm_percentage when
> data->registry_data.stable_pstate_sclk_dpm_percentage is not between 1
> and 100. The variable is then used to compute stable_pstate_sclk, which
> therefore uses an uninitialized value.
>
> Fix this by initializing stable_pstate_sclk_dpm_percentage to
> data->registry_data.stable_pstate_sclk_dpm_percentage.
>
> This issue has been found while building the kernel with clang. The
> compiler reported a -Wsometimes-uninitialized warning.
>
> Fixes: f83a9991648b ("drm/amd/powerplay: add Vega10 powerplay support (v5)")
> Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
> ---
>  drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
> index 197174e562d2..c8d28f78cd47 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
> @@ -3043,6 +3043,8 @@ static int vega10_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
>
>         if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
>                         PHM_PlatformCaps_StablePState)) {
> +               stable_pstate_sclk_dpm_percentage =
> +                       data->registry_data.stable_pstate_sclk_dpm_percentage;
>                 PP_ASSERT_WITH_CODE(
>                         data->registry_data.stable_pstate_sclk_dpm_percentage >= 1 &&
>                         data->registry_data.stable_pstate_sclk_dpm_percentage <= 100,
> --
> 2.14.1

Hello,
I have not received any comment on the above patch that I sent two
months ago, and the issue which is fixed by it still exists in today's
linux-next code [1]. Could you please review this patch?

Thanks,
Nicolas

[1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c#n3137

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

* Re: [PATCH 1/1] drm/amd/powerplay: initialize a variable before using it
@ 2017-11-04 12:21   ` Nicolas Iooss
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Iooss @ 2017-11-04 12:21 UTC (permalink / raw)
  To: Alex Deucher, Christian König, David Airlie
  Cc: ML dri-devel, amd-gfx, linux-kernel

On Sun, Sep 3, 2017 at 2:00 PM, Nicolas Iooss
<nicolas.iooss_linux@m4x.org> wrote:
>
> Function vega10_apply_state_adjust_rules() only initializes
> stable_pstate_sclk_dpm_percentage when
> data->registry_data.stable_pstate_sclk_dpm_percentage is not between 1
> and 100. The variable is then used to compute stable_pstate_sclk, which
> therefore uses an uninitialized value.
>
> Fix this by initializing stable_pstate_sclk_dpm_percentage to
> data->registry_data.stable_pstate_sclk_dpm_percentage.
>
> This issue has been found while building the kernel with clang. The
> compiler reported a -Wsometimes-uninitialized warning.
>
> Fixes: f83a9991648b ("drm/amd/powerplay: add Vega10 powerplay support (v5)")
> Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
> ---
>  drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
> index 197174e562d2..c8d28f78cd47 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
> @@ -3043,6 +3043,8 @@ static int vega10_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
>
>         if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
>                         PHM_PlatformCaps_StablePState)) {
> +               stable_pstate_sclk_dpm_percentage =
> +                       data->registry_data.stable_pstate_sclk_dpm_percentage;
>                 PP_ASSERT_WITH_CODE(
>                         data->registry_data.stable_pstate_sclk_dpm_percentage >= 1 &&
>                         data->registry_data.stable_pstate_sclk_dpm_percentage <= 100,
> --
> 2.14.1

Hello,
I have not received any comment on the above patch that I sent two
months ago, and the issue which is fixed by it still exists in today's
linux-next code [1]. Could you please review this patch?

Thanks,
Nicolas

[1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c#n3137
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 1/1] drm/amd/powerplay: initialize a variable before using it
  2017-11-04 12:21   ` Nicolas Iooss
@ 2017-11-06 21:48     ` Alex Deucher
  -1 siblings, 0 replies; 5+ messages in thread
From: Alex Deucher @ 2017-11-06 21:48 UTC (permalink / raw)
  To: Nicolas Iooss
  Cc: Alex Deucher, Christian König, David Airlie, ML dri-devel,
	amd-gfx list, linux-kernel

On Sat, Nov 4, 2017 at 8:21 AM, Nicolas Iooss
<nicolas.iooss_linux@m4x.org> wrote:
> On Sun, Sep 3, 2017 at 2:00 PM, Nicolas Iooss
> <nicolas.iooss_linux@m4x.org> wrote:
>>
>> Function vega10_apply_state_adjust_rules() only initializes
>> stable_pstate_sclk_dpm_percentage when
>> data->registry_data.stable_pstate_sclk_dpm_percentage is not between 1
>> and 100. The variable is then used to compute stable_pstate_sclk, which
>> therefore uses an uninitialized value.
>>
>> Fix this by initializing stable_pstate_sclk_dpm_percentage to
>> data->registry_data.stable_pstate_sclk_dpm_percentage.
>>
>> This issue has been found while building the kernel with clang. The
>> compiler reported a -Wsometimes-uninitialized warning.
>>
>> Fixes: f83a9991648b ("drm/amd/powerplay: add Vega10 powerplay support (v5)")
>> Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
>> ---
>>  drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
>> index 197174e562d2..c8d28f78cd47 100644
>> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
>> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
>> @@ -3043,6 +3043,8 @@ static int vega10_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
>>
>>         if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
>>                         PHM_PlatformCaps_StablePState)) {
>> +               stable_pstate_sclk_dpm_percentage =
>> +                       data->registry_data.stable_pstate_sclk_dpm_percentage;
>>                 PP_ASSERT_WITH_CODE(
>>                         data->registry_data.stable_pstate_sclk_dpm_percentage >= 1 &&
>>                         data->registry_data.stable_pstate_sclk_dpm_percentage <= 100,
>> --
>> 2.14.1
>
> Hello,
> I have not received any comment on the above patch that I sent two
> months ago, and the issue which is fixed by it still exists in today's
> linux-next code [1]. Could you please review this patch?

Reviewed and applied.  Sorry for missing this.  Feel free to ping
sooner if it looks like something slipped through the cracks.

Thanks,

Alex


>
> Thanks,
> Nicolas
>
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c#n3137
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 1/1] drm/amd/powerplay: initialize a variable before using it
@ 2017-11-06 21:48     ` Alex Deucher
  0 siblings, 0 replies; 5+ messages in thread
From: Alex Deucher @ 2017-11-06 21:48 UTC (permalink / raw)
  To: Nicolas Iooss
  Cc: David Airlie, linux-kernel, amd-gfx list, ML dri-devel,
	Alex Deucher, Christian König

On Sat, Nov 4, 2017 at 8:21 AM, Nicolas Iooss
<nicolas.iooss_linux@m4x.org> wrote:
> On Sun, Sep 3, 2017 at 2:00 PM, Nicolas Iooss
> <nicolas.iooss_linux@m4x.org> wrote:
>>
>> Function vega10_apply_state_adjust_rules() only initializes
>> stable_pstate_sclk_dpm_percentage when
>> data->registry_data.stable_pstate_sclk_dpm_percentage is not between 1
>> and 100. The variable is then used to compute stable_pstate_sclk, which
>> therefore uses an uninitialized value.
>>
>> Fix this by initializing stable_pstate_sclk_dpm_percentage to
>> data->registry_data.stable_pstate_sclk_dpm_percentage.
>>
>> This issue has been found while building the kernel with clang. The
>> compiler reported a -Wsometimes-uninitialized warning.
>>
>> Fixes: f83a9991648b ("drm/amd/powerplay: add Vega10 powerplay support (v5)")
>> Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
>> ---
>>  drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
>> index 197174e562d2..c8d28f78cd47 100644
>> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
>> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
>> @@ -3043,6 +3043,8 @@ static int vega10_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
>>
>>         if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
>>                         PHM_PlatformCaps_StablePState)) {
>> +               stable_pstate_sclk_dpm_percentage =
>> +                       data->registry_data.stable_pstate_sclk_dpm_percentage;
>>                 PP_ASSERT_WITH_CODE(
>>                         data->registry_data.stable_pstate_sclk_dpm_percentage >= 1 &&
>>                         data->registry_data.stable_pstate_sclk_dpm_percentage <= 100,
>> --
>> 2.14.1
>
> Hello,
> I have not received any comment on the above patch that I sent two
> months ago, and the issue which is fixed by it still exists in today's
> linux-next code [1]. Could you please review this patch?

Reviewed and applied.  Sorry for missing this.  Feel free to ping
sooner if it looks like something slipped through the cracks.

Thanks,

Alex


>
> Thanks,
> Nicolas
>
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c#n3137
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2017-11-06 21:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-03 12:00 [PATCH 1/1] drm/amd/powerplay: initialize a variable before using it Nicolas Iooss
2017-11-04 12:21 ` Nicolas Iooss
2017-11-04 12:21   ` Nicolas Iooss
2017-11-06 21:48   ` Alex Deucher
2017-11-06 21:48     ` Alex Deucher

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.