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

ASoC: SOF: Replace zero-length array with flexible-array

There is a regular need in the kernel to provide a way to declare having a
dynamically sized set of trailing elements in a structure. Kernel code should
always use “flexible array members”[1] for these cases. The older style of
one-element or zero-length arrays should no longer be used[2].

[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://github.com/KSPP/linux/issues/21

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>

+4 -4
+4 -4
sound/soc/sof/probe.h
··· 36 36 struct sof_ipc_probe_dma_add_params { 37 37 struct sof_ipc_cmd_hdr hdr; 38 38 unsigned int num_elems; 39 - struct sof_probe_dma dma[0]; 39 + struct sof_probe_dma dma[]; 40 40 } __packed; 41 41 42 42 struct sof_ipc_probe_info_params { ··· 51 51 struct sof_ipc_probe_dma_remove_params { 52 52 struct sof_ipc_cmd_hdr hdr; 53 53 unsigned int num_elems; 54 - unsigned int stream_tag[0]; 54 + unsigned int stream_tag[]; 55 55 } __packed; 56 56 57 57 struct sof_ipc_probe_point_add_params { 58 58 struct sof_ipc_cmd_hdr hdr; 59 59 unsigned int num_elems; 60 - struct sof_probe_point_desc desc[0]; 60 + struct sof_probe_point_desc desc[]; 61 61 } __packed; 62 62 63 63 struct sof_ipc_probe_point_remove_params { 64 64 struct sof_ipc_cmd_hdr hdr; 65 65 unsigned int num_elems; 66 - unsigned int buffer_id[0]; 66 + unsigned int buffer_id[]; 67 67 } __packed; 68 68 69 69 int sof_ipc_probe_init(struct snd_sof_dev *sdev,