]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
usb: gadget: uvc: Avoid -Wflex-array-member-not-at-end warnings
authorGustavo A. R. Silva <gustavoars@kernel.org>
Mon, 17 Mar 2025 00:52:51 +0000 (11:22 +1030)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Apr 2025 14:08:33 +0000 (16:08 +0200)
-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 uvc_input_header_descriptor` is a flexible structure --a
structure that contains a flexible-array member.

With this, fix three of the following warnings:

drivers/usb/gadget/function/uvc_configfs.h:77:57: 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>
Reviewed-by: Kees Cook <kees@kernel.org>
Link: https://lore.kernel.org/r/Z9dyY7_ydJiGqh_d@kspp
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/uvc_configfs.h

index 2f78cd4f396f240e10f8db7e991253c8a1496d5d..9391614135e93292731d0bdfc3d4fe5fc4f7e235 100644 (file)
@@ -74,10 +74,12 @@ static inline struct uvcg_format *to_uvcg_format(struct config_item *item)
 
 struct uvcg_streaming_header {
        struct config_item                              item;
-       struct uvc_input_header_descriptor              desc;
        unsigned                                        linked;
        struct list_head                                formats;
        unsigned                                        num_fmt;
+
+       /* Must be last --ends in a flexible-array member. */
+       struct uvc_input_header_descriptor              desc;
 };
 
 static inline struct uvcg_streaming_header *to_uvcg_streaming_header(struct config_item *item)