staging: greybus: fix stack size warning with UBSAN

commit 144779edf598e0896302c35a0926ef0b68f17c4b upstream.

clang warns about excessive stack usage in this driver when
UBSAN is enabled:

drivers/staging/greybus/audio_topology.c:977:12: error: stack frame size of 1836 bytes in function 'gbaudio_tplg_create_widget' [-Werror,-Wframe-larger-than=]

Rework this code to no longer use compound literals for
initializing the structure in each case, but instead keep
the common bits in a preallocated constant array and copy
them as needed.

Reviewed-by: Nick Desaulniers <>
Reviewed-by: Alex Elder <>
Signed-off-by: Arnd Bergmann <>
[nathan: Address review comments from v1]
Signed-off-by: Nathan Chancellor <>
Signed-off-by: Greg Kroah-Hartman <>
1 file changed