[PATCH 3/3] drm/amd/pm: explicitly initialize cached power limits in smu struct

Lazar, Lijo lijo.lazar at amd.com
Mon Oct 4 10:43:05 UTC 2021



On 10/3/2021 10:16 AM, Darren Powell wrote:
> Code appears to initialize values but macro will exit without error
> or initializing value if function is not implmented
> 
> Signed-off-by: Darren Powell <darren.powell at amd.com>
> ---
>   drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> index faa78a048b1f..210f047e136d 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> @@ -712,6 +712,10 @@ static int smu_late_init(void *handle)
>   		return ret;
>   	}
>   
> +	smu->current_power_limit = 0;
> +	smu->default_power_limit = 0;
> +	smu->max_power_limit = 0;
> +

If this is only about first-time init - smu_context is part of adev, it 
will be zero initialized when adev is allocated.


Thanks,
Lijo

>   	ret = smu_get_asic_power_limits(smu,
>   					&smu->current_power_limit,
>   					&smu->default_power_limit,
> 


More information about the amd-gfx mailing list