]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: SOF: sof-audio: Avoid -Wflex-array-member-not-at-end warnings
authorGustavo A. R. Silva <gustavoars@kernel.org>
Mon, 5 Aug 2024 15:28:55 +0000 (09:28 -0600)
committerMark Brown <broonie@kernel.org>
Thu, 8 Aug 2024 08:17:16 +0000 (09:17 +0100)
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are
getting ready to enable it, globally.

Move the conflicting declaration to the end of the structure. Notice
that `struct snd_sof_pcm` ends in a flexible-array member through
`struct snd_soc_tplg_pcm` -> `struct snd_soc_tplg_private`.

Whith this, fix the following warnings:
sound/soc/sof/sof-audio.h:350:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
./include/trace/events/../../../sound/soc/sof/sof-audio.h:350:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
sound/soc/amd/../sof/amd/../sof-audio.h:350:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
sound/soc/sof/amd/../sof-audio.h:350:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
sound/soc/sof/intel/../sof-audio.h:350:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
sound/soc/sof/mediatek/mt8186/../../sof-audio.h:350:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
sound/soc/sof/mediatek/mt8195/../../sof-audio.h:350:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://patch.msgid.link/ZrDvt6eyeFyajq6l@cute
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/sof-audio.h

index b9b8b64768b9794a237d5141bce6cc2613787953..01b819dd84984152330f5502f96c58fe2781ef9a 100644 (file)
@@ -347,12 +347,14 @@ struct snd_sof_pcm_stream {
 /* ALSA SOF PCM device */
 struct snd_sof_pcm {
        struct snd_soc_component *scomp;
-       struct snd_soc_tplg_pcm pcm;
        struct snd_sof_pcm_stream stream[2];
        struct list_head list;  /* list in sdev pcm list */
        struct snd_pcm_hw_params params[2];
        bool prepared[2]; /* PCM_PARAMS set successfully */
        bool pending_stop[2]; /* only used if (!pcm_ops->platform_stop_during_hw_free) */
+
+       /* Must be last - ends in a flex-array member. */
+       struct snd_soc_tplg_pcm pcm;
 };
 
 struct snd_sof_led_control {