Skip to content

Commit a860f26

Browse files
nathanchancemripard
authored andcommitted
drm/selftest: plane_helper: Put test structures in static storage
Clang warns on certain 32-bit architectures: drivers/gpu/drm/selftests/test-drm_plane_helper.c:76:5: warning: stack frame size (1064) exceeds limit (1024) in 'igt_check_plane_state' [-Wframe-larger-than] int igt_check_plane_state(void *ignored) ^ 1 warning generated. The structures in igt_check_plane_state() total 1008 bytes, so any small amount of inlining will cause the stack frame to exceed the 32-bit limit of 1024, triggering the warning. Move these structures to static storage, which dramatically reduces the amount of stack space in igt_check_plane_state(). There is no testing impact, as igt_check_plane_state() is only called once in the driver. Fixes: 943e6a8 ("mock a drm_plane in igt_check_plane_state to make the test more robust") Link: ClangBuiltLinux#1600 Reported-by: kernel test robot <lkp@intel.com> Suggested-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Maxime Ripard <maxime@cerno.tech> Link: https://patchwork.freedesktop.org/patch/msgid/20220302235909.784935-1-nathan@kernel.org
1 parent 1d204ee commit a860f26

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/gpu/drm/selftests/test-drm_plane_helper.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ int igt_check_plane_state(void *ignored)
7777
{
7878
int ret;
7979

80-
const struct drm_crtc_state crtc_state = {
80+
static const struct drm_crtc_state crtc_state = {
8181
.crtc = ZERO_SIZE_PTR,
8282
.enable = true,
8383
.active = true,
@@ -87,14 +87,14 @@ int igt_check_plane_state(void *ignored)
8787
DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC)
8888
},
8989
};
90-
struct drm_plane plane = {
90+
static struct drm_plane plane = {
9191
.dev = NULL
9292
};
93-
struct drm_framebuffer fb = {
93+
static struct drm_framebuffer fb = {
9494
.width = 2048,
9595
.height = 2048
9696
};
97-
struct drm_plane_state plane_state = {
97+
static struct drm_plane_state plane_state = {
9898
.plane = &plane,
9999
.crtc = ZERO_SIZE_PTR,
100100
.fb = &fb,

0 commit comments

Comments
 (0)