diff options
author | Arnd Bergmann <arnd@arndb.de> | 2020-01-08 14:51:05 +0100 |
---|---|---|
committer | Sam Ravnborg <sam@ravnborg.org> | 2020-01-12 21:11:57 +0100 |
commit | dba9bf0a98c5fcfb3f616bf2446d5aeef67b632c (patch) | |
tree | ac03c1453fd280f0f650d94a57175eb438dc81a1 /drivers/gpu/drm/panel/panel-tpo-td028ttec1.c | |
parent | 0980939d2a7065e2264022b8b7492a85e7549101 (diff) |
drm: panel: fix excessive stack usage in td028ttec1_prepare
With gcc -O3 in combination with the structleak plug, the compiler can
inline very aggressively, leading to rather large stack usage:
drivers/gpu/drm/panel/panel-tpo-td028ttec1.c: In function 'td028ttec1_prepare':
drivers/gpu/drm/panel/panel-tpo-td028ttec1.c:233:1: error: the frame size of 2768 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
}
Marking jbt_reg_write_*() as noinline avoids the case where
multiple instances of this function get inlined into the same
stack frame and each one adds a copy of 'tx_buf'.
The compiler is clearly making some bad decisions here, but I
did not open a new bug report as this only happens in combination
with the structleak plugin.
This fixes mmtom ("init/Kconfig: enable -O3 for all arches")
Link: https://lore.kernel.org/lkml/CAK8P3a3jAnFZA3GFRtdYdg1-i-oih3pOQzkkrK-X3BGsFrMiZQ@mail.gmail.com/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org> [fix indent]
Link: https://patchwork.freedesktop.org/patch/msgid/20200108135116.3687988-1-arnd@arndb.de
Diffstat (limited to 'drivers/gpu/drm/panel/panel-tpo-td028ttec1.c')
-rw-r--r-- | drivers/gpu/drm/panel/panel-tpo-td028ttec1.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c b/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c index cf29405a2dbe..aeca15dfeb3c 100644 --- a/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c +++ b/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c @@ -86,7 +86,12 @@ struct td028ttec1_panel { #define to_td028ttec1_device(p) container_of(p, struct td028ttec1_panel, panel) -static int jbt_ret_write_0(struct td028ttec1_panel *lcd, u8 reg, int *err) +/* + * noinline_for_stack so we don't get multiple copies of tx_buf + * on the stack in case of gcc-plugin-structleak + */ +static int noinline_for_stack +jbt_ret_write_0(struct td028ttec1_panel *lcd, u8 reg, int *err) { struct spi_device *spi = lcd->spi; u16 tx_buf = JBT_COMMAND | reg; @@ -105,8 +110,9 @@ static int jbt_ret_write_0(struct td028ttec1_panel *lcd, u8 reg, int *err) return ret; } -static int jbt_reg_write_1(struct td028ttec1_panel *lcd, - u8 reg, u8 data, int *err) +static int noinline_for_stack +jbt_reg_write_1(struct td028ttec1_panel *lcd, + u8 reg, u8 data, int *err) { struct spi_device *spi = lcd->spi; u16 tx_buf[2]; @@ -128,8 +134,9 @@ static int jbt_reg_write_1(struct td028ttec1_panel *lcd, return ret; } -static int jbt_reg_write_2(struct td028ttec1_panel *lcd, - u8 reg, u16 data, int *err) +static int noinline_for_stack +jbt_reg_write_2(struct td028ttec1_panel *lcd, + u8 reg, u16 data, int *err) { struct spi_device *spi = lcd->spi; u16 tx_buf[3]; |