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

From: Jonathan Cameron
Date: Sun Mar 30 2025 - 14:12:11 EST


On Wed, 19 Mar 2025 09:13:45 +0000
Tzung-Bi Shih <tzungbi@xxxxxxxxxx> wrote:

> On Tue, Mar 18, 2025 at 08:42:41AM -0700, Kees Cook wrote:
> > > + ((struct ec_params_get_cmd_versions *)buf->data)->cmd = cmd;
> > > +
> > > + ret = cros_ec_cmd_xfer_status(ec_dev, buf);
> > > if (ret >= 0)
> > > - *mask = buf.resp.version_mask;
> > > + *mask = ((struct ec_response_get_cmd_versions *)buf->data)->version_mask;
> > > return ret;
> > > }
> >
> > Since "params" is used twice, I'd say do like the other patch and assign
> > it to a new variable:
> >
> > struct ec_response_get_cmd_versions *params = buf->data;
> > ...
> > params->cmd = cmd;
> > ...
> > *mask = params->version_mask;
>
> Not a pushback for introducing new variables. FWIW, it uses "param" and
> "response" only once.

Given that reply I'm assuming Kees is fine with this.

Applied.

Thanks,

Jonathan