Re: [PATCH 14/40] drm/amd/display/dc/calcs/dce_calcs: Remove some large variables from the stack

From: Lee Jones
Date: Tue Jan 12 2021 - 08:44:26 EST


On Mon, 11 Jan 2021, Lee Jones wrote:

> Fixes the following W=1 kernel build warning(s):
>
> drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c: In function ‘bw_calcs_init’:
> drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c:2726:1: warning: the frame size of 1336 bytes is larger than 1024 bytes [-Wframe-larger-than=]
>
> Cc: Harry Wentland <harry.wentland@xxxxxxx>
> Cc: Leo Li <sunpeng.li@xxxxxxx>
> Cc: Alex Deucher <alexander.deucher@xxxxxxx>
> Cc: "Christian König" <christian.koenig@xxxxxxx>
> Cc: David Airlie <airlied@xxxxxxxx>
> Cc: Daniel Vetter <daniel@xxxxxxxx>
> Cc: amd-gfx@xxxxxxxxxxxxxxxxxxxxx
> Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx
> Signed-off-by: Lee Jones <lee.jones@xxxxxxxxxx>
> ---
> .../gpu/drm/amd/display/dc/calcs/dce_calcs.c | 1115 +++++++++--------
> 1 file changed, 560 insertions(+), 555 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
> index a0c69fae40ced..f69c2b84d432b 100644
> --- a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
> +++ b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
> @@ -2035,707 +2035,712 @@ void bw_calcs_init(struct bw_calcs_dceip *bw_dceip,
> struct bw_calcs_vbios *bw_vbios,
> struct hw_asic_id asic_id)
> {
> - struct bw_calcs_dceip dceip = { 0 };
> - struct bw_calcs_vbios vbios = { 0 };
> + struct bw_calcs_dceip *dceip;
> + struct bw_calcs_vbios *vbios;
>
> enum bw_calcs_version version = bw_calcs_version_from_asic_id(asic_id);
>
> - dceip.version = version;
> + dceip = kzalloc(sizeof(dceip), GFP_KERNEL);
> + vbios = kzalloc(sizeof(vbios), GFP_KERNEL);

Please don't review/merge this yet. I missed some error checking.

--
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog