Re: [PATCH][next] iio: proximity: cros_ec_mkbp_proximity: Avoid -Wflex-array-member-not-at-end warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 17 Mar 2025 01:36:58 +0000
Tzung-Bi Shih <tzungbi@xxxxxxxxxx> 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)?





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux