Skip to content

Commit 8abbbbb

Browse files
GustavoARSilvaTzung-Bi Shih
authored andcommitted
platform/chrome: cros_ec: Avoid -Wflex-array-member-not-at-end warning
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally. Use the new TRAILING_OVERLAP() helper to fix the following warning: drivers/platform/chrome/cros_ec.c:106:40: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] This helper creates a union between a flexible-array member (FAM) and a set of members that would otherwise follow it. This overlays the trailing members onto the FAM while preserving the original memory layout. Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Link: https://lore.kernel.org/r/aJnvuv334M7TljoB@kspp Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
1 parent 032c59c commit 8abbbbb

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/platform/chrome/cros_ec.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,13 @@ EXPORT_SYMBOL(cros_ec_irq_thread);
102102
static int cros_ec_sleep_event(struct cros_ec_device *ec_dev, u8 sleep_event)
103103
{
104104
int ret;
105-
struct {
106-
struct cros_ec_command msg;
105+
TRAILING_OVERLAP(struct cros_ec_command, msg, data,
107106
union {
108107
struct ec_params_host_sleep_event req0;
109108
struct ec_params_host_sleep_event_v1 req1;
110109
struct ec_response_host_sleep_event_v1 resp1;
111110
} u;
112-
} __packed buf;
111+
) __packed buf;
113112

114113
memset(&buf, 0, sizeof(buf));
115114

0 commit comments

Comments
 (0)