]> www.infradead.org Git - nvme.git/commitdiff
nvme-loop: avoid -Wflex-array-member-not-at-end warning
authorGustavo A. R. Silva <gustavoars@kernel.org>
Fri, 28 Mar 2025 14:25:08 +0000 (08:25 -0600)
committerChristoph Hellwig <hch@lst.de>
Tue, 22 Apr 2025 07:57:25 +0000 (09:57 +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 nvme_loop_iod` is a flexible structure --a structure
that contains a flexible-array member.

Fix the following warning:

drivers/nvme/target/loop.c:36: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>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/loop.c

index a5c41144667c681e55e09e3c92c523e2d98a6ad7..d02b80803278c3fb644a25352e43095bc5d21280 100644 (file)
@@ -33,10 +33,12 @@ struct nvme_loop_ctrl {
 
        struct list_head        list;
        struct blk_mq_tag_set   tag_set;
-       struct nvme_loop_iod    async_event_iod;
        struct nvme_ctrl        ctrl;
 
        struct nvmet_port       *port;
+
+       /* Must be last --ends in a flexible-array member. */
+       struct nvme_loop_iod    async_event_iod;
 };
 
 static inline struct nvme_loop_ctrl *to_loop_ctrl(struct nvme_ctrl *ctrl)