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

ASoC: SOF: control.h: Replace zero-length array with DECLARE_FLEX_ARRAY() helper

Zero-length arrays are deprecated and we are moving towards adopting
C99 flexible-array members, instead. So, replace zero-length arrays
declarations in anonymous union with the new DECLARE_FLEX_ARRAY()
helper macro.

This helper allows for flexible-array members in unions.

Link: https://github.com/KSPP/linux/issues/193
Link: https://github.com/KSPP/linux/issues/211
Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/YzIcZ11k8RiQtS2T@work
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Gustavo A. R. Silva and committed by
Mark Brown
b264ef79 5445e5db

+3 -3
+3 -3
include/sound/sof/control.h
··· 117 117 /* control data - add new types if needed */ 118 118 union { 119 119 /* channel values can be used by volume type controls */ 120 - struct sof_ipc_ctrl_value_chan chanv[0]; 120 + DECLARE_FLEX_ARRAY(struct sof_ipc_ctrl_value_chan, chanv); 121 121 /* component values used by routing controls like mux, mixer */ 122 - struct sof_ipc_ctrl_value_comp compv[0]; 122 + DECLARE_FLEX_ARRAY(struct sof_ipc_ctrl_value_comp, compv); 123 123 /* data can be used by binary controls */ 124 - struct sof_abi_hdr data[0]; 124 + DECLARE_FLEX_ARRAY(struct sof_abi_hdr, data); 125 125 }; 126 126 } __packed; 127 127