From: Mark Brown <broonie@kernel.org>
To: Lucas Tanure <tanureal@opensource.cirrus.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J . Wysocki" <rafael@kernel.org>,
linux-kernel@vger.kernel.org, patches@opensource.cirrus.com
Subject: Re: [PATCH v3 2/2] regmap: spi: Check raw_[read|write] against max message size
Date: Wed, 15 Sep 2021 13:51:41 +0100 [thread overview]
Message-ID: <20210915125140.GE5389@sirena.org.uk> (raw)
In-Reply-To: <20210915120951.29907-2-tanureal@opensource.cirrus.com>
[-- Attachment #1: Type: text/plain, Size: 1267 bytes --]
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.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2021-09-15 12:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-15 12:09 [PATCH v3 1/2] regmap: spi: Set regmap max raw r/w from max_transfer_size Lucas Tanure
2021-09-15 12:09 ` [PATCH v3 2/2] regmap: spi: Check raw_[read|write] against max message size Lucas Tanure
2021-09-15 12:51 ` Mark Brown [this message]
2021-09-15 12:34 ` [PATCH v3 1/2] regmap: spi: Set regmap max raw r/w from max_transfer_size Mark Brown
2021-09-15 12:37 ` Lucas tanure
2021-09-15 12:57 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210915125140.GE5389@sirena.org.uk \
--to=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=rafael@kernel.org \
--cc=tanureal@opensource.cirrus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®