Commit 3f49edf4 authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Jakub Kicinski

net/fungible: Avoid -Wflex-array-member-not-at-end warning

Use the `DEFINE_RAW_FLEX()` helper for an on-stack definition of
a flexible structure where the size of the flexible-array member
is known at compile-time, and refactor the rest of the code,
accordingly.

So, with these changes, fix the following warning:
drivers/net/ethernet/fungible/funcore/fun_dev.c:550:43: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
Link: https://patch.msgid.link/ZrDwEugW7DR/FlP5@cuteSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent e66f33bd
...@@ -546,17 +546,14 @@ int fun_bind(struct fun_dev *fdev, enum fun_admin_bind_type type0, ...@@ -546,17 +546,14 @@ int fun_bind(struct fun_dev *fdev, enum fun_admin_bind_type type0,
unsigned int id0, enum fun_admin_bind_type type1, unsigned int id0, enum fun_admin_bind_type type1,
unsigned int id1) unsigned int id1)
{ {
struct { DEFINE_RAW_FLEX(struct fun_admin_bind_req, cmd, entry, 2);
struct fun_admin_bind_req req;
struct fun_admin_bind_entry entry[2]; cmd->common = FUN_ADMIN_REQ_COMMON_INIT2(FUN_ADMIN_OP_BIND,
} cmd = { __struct_size(cmd));
.req.common = FUN_ADMIN_REQ_COMMON_INIT2(FUN_ADMIN_OP_BIND, cmd->entry[0] = FUN_ADMIN_BIND_ENTRY_INIT(type0, id0);
sizeof(cmd)), cmd->entry[1] = FUN_ADMIN_BIND_ENTRY_INIT(type1, id1);
.entry[0] = FUN_ADMIN_BIND_ENTRY_INIT(type0, id0),
.entry[1] = FUN_ADMIN_BIND_ENTRY_INIT(type1, id1),
};
return fun_submit_admin_sync_cmd(fdev, &cmd.req.common, NULL, 0, 0); return fun_submit_admin_sync_cmd(fdev, &cmd->common, NULL, 0, 0);
} }
EXPORT_SYMBOL_GPL(fun_bind); EXPORT_SYMBOL_GPL(fun_bind);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment