Messages in this thread | | | Date | Wed, 15 Sep 2021 13:51:41 +0100 | From | Mark Brown <> | Subject | Re: [PATCH v3 2/2] regmap: spi: Check raw_[read|write] against max message size |
| |
On Wed, Sep 15, 2021 at 01:09:51PM +0100, Lucas Tanure wrote: > regmap-spi will split data and address between two transfers > in the same message, so max_[read|write] must include space > for the address and padding > > Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com> > --- > > Changes v3: > New series
The changelog in patch 1 claimed that v2 was the first version of a new series. Which is it? If you're going to include an inter-version changelog it should be meaningful, just writing something for the sake of providing a changelog tends to only cause confusion.
> + if (spi_max_message_size(spi) != SIZE_MAX) > + bus->max_combined_rw = spi_max_message_size(spi); > +
Why is this conditional? The whole point in returning SIZE_MAX is that users don't need to care if there's a limit or not, any client logic checking sizes will always work.
> + if (map->max_raw_read < map->format.buf_size || > + map->max_raw_write < map->format.buf_size) { > + ret = -EINVAL; > + goto err_hwlock; > + } > + }
This is at best an assert that the logic in _init() is self-consistent so just silently returning an error doesn't seem like the right thing to do, it's going to be super obscure for users. [unhandled content-type:application/pgp-signature] | |