diff mbox series

[18/30] drm/amd/display/dc/core/dc_link: Move some local data from the stack to the heap

Message ID 20210113080752.1003793-19-lee.jones@linaro.org
State Accepted
Commit 3a00c04212d1cfe1426338b78f4ead623508c874
Headers show
Series Finally rid W=1 warnings from GPU | expand

Commit Message

Lee Jones Jan. 13, 2021, 8:07 a.m. UTC
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link.c: In function ‘dc_link_construct’:
 drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link.c:1588:1: warning: the frame size of 1176 bytes is larger than 1024 bytes [-Wframe-larger-than=]

Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Comments

Alex Deucher Jan. 14, 2021, 5:17 p.m. UTC | #1
On Wed, Jan 13, 2021 at 3:08 AM Lee Jones <lee.jones@linaro.org> wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link.c: In function ‘dc_link_construct’:
>  drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link.c:1588:1: warning: the frame size of 1176 bytes is larger than 1024 bytes [-Wframe-larger-than=]
>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Leo Li <sunpeng.li@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones <lee.jones@linaro.org>

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/amd/display/dc/core/dc_link.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
> index 8ccda8b9ac2eb..3366a49f11dc7 100644
> --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
> +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
> @@ -1364,13 +1364,17 @@ static bool dc_link_construct(struct dc_link *link,
>         struct dc_context *dc_ctx = init_params->ctx;
>         struct encoder_init_data enc_init_data = { 0 };
>         struct panel_cntl_init_data panel_cntl_init_data = { 0 };
> -       struct integrated_info info = {{{ 0 }}};
> +       struct integrated_info *info;
>         struct dc_bios *bios = init_params->dc->ctx->dc_bios;
>         const struct dc_vbios_funcs *bp_funcs = bios->funcs;
>         struct bp_disp_connector_caps_info disp_connect_caps_info = { 0 };
>
>         DC_LOGGER_INIT(dc_ctx->logger);
>
> +       info = kzalloc(sizeof(info), GFP_KERNEL);
> +       if (!info)
> +               goto create_fail;
> +
>         link->irq_source_hpd = DC_IRQ_SOURCE_INVALID;
>         link->irq_source_hpd_rx = DC_IRQ_SOURCE_INVALID;
>
> @@ -1532,12 +1536,12 @@ static bool dc_link_construct(struct dc_link *link,
>         }
>
>         if (bios->integrated_info)
> -               info = *bios->integrated_info;
> +               memcpy(info, bios->integrated_info, sizeof(*info));
>
>         /* Look for channel mapping corresponding to connector and device tag */
>         for (i = 0; i < MAX_NUMBER_OF_EXT_DISPLAY_PATH; i++) {
>                 struct external_display_path *path =
> -                       &info.ext_disp_conn_info.path[i];
> +                       &info->ext_disp_conn_info.path[i];
>
>                 if (path->device_connector_id.enum_id == link->link_id.enum_id &&
>                     path->device_connector_id.id == link->link_id.id &&
> @@ -1584,6 +1588,8 @@ static bool dc_link_construct(struct dc_link *link,
>                 link->hpd_gpio = NULL;
>         }
>
> +       kfree(info);
> +
>         return false;
>  }
>
> --
> 2.25.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
index 8ccda8b9ac2eb..3366a49f11dc7 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
@@ -1364,13 +1364,17 @@  static bool dc_link_construct(struct dc_link *link,
 	struct dc_context *dc_ctx = init_params->ctx;
 	struct encoder_init_data enc_init_data = { 0 };
 	struct panel_cntl_init_data panel_cntl_init_data = { 0 };
-	struct integrated_info info = {{{ 0 }}};
+	struct integrated_info *info;
 	struct dc_bios *bios = init_params->dc->ctx->dc_bios;
 	const struct dc_vbios_funcs *bp_funcs = bios->funcs;
 	struct bp_disp_connector_caps_info disp_connect_caps_info = { 0 };
 
 	DC_LOGGER_INIT(dc_ctx->logger);
 
+	info = kzalloc(sizeof(info), GFP_KERNEL);
+	if (!info)
+		goto create_fail;
+
 	link->irq_source_hpd = DC_IRQ_SOURCE_INVALID;
 	link->irq_source_hpd_rx = DC_IRQ_SOURCE_INVALID;
 
@@ -1532,12 +1536,12 @@  static bool dc_link_construct(struct dc_link *link,
 	}
 
 	if (bios->integrated_info)
-		info = *bios->integrated_info;
+		memcpy(info, bios->integrated_info, sizeof(*info));
 
 	/* Look for channel mapping corresponding to connector and device tag */
 	for (i = 0; i < MAX_NUMBER_OF_EXT_DISPLAY_PATH; i++) {
 		struct external_display_path *path =
-			&info.ext_disp_conn_info.path[i];
+			&info->ext_disp_conn_info.path[i];
 
 		if (path->device_connector_id.enum_id == link->link_id.enum_id &&
 		    path->device_connector_id.id == link->link_id.id &&
@@ -1584,6 +1588,8 @@  static bool dc_link_construct(struct dc_link *link,
 		link->hpd_gpio = NULL;
 	}
 
+	kfree(info);
+
 	return false;
 }