On Mon, 17 Mar 2025 01:36:58 +0000
Tzung-Bi Shih <[email protected]> wrote:

> On Mon, Mar 17, 2025 at 11:25:40AM +1030, Gustavo A. R. Silva wrote:
> >  static int cros_ec_mkbp_proximity_query(struct cros_ec_device *ec_dev,
> >                                     int *state)
> >  {
> > -   struct {
> > -           struct cros_ec_command msg;
> > -           union {
> > -                   struct ec_params_mkbp_info params;
> > -                   u32 switches;
> > -           };
> > -   } __packed buf = { };
> > -   struct ec_params_mkbp_info *params = &buf.params;
> > -   struct cros_ec_command *msg = &buf.msg;
> > -   u32 *switches = &buf.switches;
> > +   DEFINE_RAW_FLEX(struct cros_ec_command, buf, data, sizeof(u32));  
> 
> max(sizeof(struct ec_params_mkbp_info), sizeof(u32))?

If not (I assume same reason as previous case), then maybe an assert
that sizeof(struct ec_params_mkbp_info) <= sizeof(u32)?


Reply via email to