Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/bridge: fix stack usage warning on old gcc

Some older versions of gcc badly optimize code that passes
an inline function argument into another function by reference,
causing huge stack usage:

drivers/gpu/drm/bridge/tc358768.c: In function 'tc358768_bridge_pre_enable':
drivers/gpu/drm/bridge/tc358768.c:840:1: error: the frame size of 2256 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]

Use a temporary variable as a workaround and add a comment pointing
to the gcc bug.

Fixes: ff1ca6397b1d ("drm/bridge: Add tc358768 driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200428215408.4111675-1-arnd@arndb.de

authored by

Arnd Bergmann and committed by
Sam Ravnborg
78b0d99a 6d4f3e2b

+3 -1
+3 -1
drivers/gpu/drm/bridge/tc358768.c
··· 178 178 179 179 static void tc358768_write(struct tc358768_priv *priv, u32 reg, u32 val) 180 180 { 181 + /* work around https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81715 */ 182 + int tmpval = val; 181 183 size_t count = 2; 182 184 183 185 if (priv->error) ··· 189 187 if (reg < 0x100 || reg >= 0x600) 190 188 count = 1; 191 189 192 - priv->error = regmap_bulk_write(priv->regmap, reg, &val, count); 190 + priv->error = regmap_bulk_write(priv->regmap, reg, &tmpval, count); 193 191 } 194 192 195 193 static void tc358768_read(struct tc358768_priv *priv, u32 reg, u32 *val)