lkml.org 
[lkml]   [2021]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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]
\
 
 \ /
  Last update: 2021-09-15 14:53    [W:0.042 / U:0.492 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site