From: Srinivas Kandagatla <srini@kernel.org>
To: Emil Renner Berthing <emil.renner.berthing@canonical.com>,
linux-kernel@vger.kernel.org
Cc: Srinivas Kandagatla <srini@kernel.org>,
Samuel Holland <samuel@sholland.org>,
Dmitry Baryshkov <lumag@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH v1] nvmem: core: update cell->bytes after shifting bits
Date: Mon, 10 Nov 2025 08:32:08 +0000 [thread overview]
Message-ID: <3951551f-02e9-41a3-8212-ac1cbaecc69a@kernel.org> (raw)
In-Reply-To: <20250930142212.521925-1-emil.renner.berthing@canonical.com>
On 9/30/25 3:22 PM, Emil Renner Berthing wrote:
> When support for bit offsets of more than one byte was added it
> unfortunately left the cell->bytes value at the number of bytes read
> including the offset. Make sure to update it to the proper number of
> meaningful bytes in the returned data.
Sorry somehow I missed this patch.
If the number of bytes are different to the bytes that are part of cell
then the parsing code seems to have missed some cases, which is the
right place to fix.
Can you share more details on the values that you pass as part of the
cell definition.
> Fixes: 7a06ef751077 ("nvmem: core: fix bit offsets of more than one byte")
missing CC stable
> Signed-off-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
> ---
> drivers/nvmem/core.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index 387c88c55259..5f6d22545e39 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -1640,6 +1640,8 @@ static void nvmem_shift_read_buffer_in_place(struct nvmem_cell_entry *cell, void
> /* clear msb bits if any leftover in the last byte */
> if (cell->nbits % BITS_PER_BYTE)
> *p &= GENMASK((cell->nbits % BITS_PER_BYTE) - 1, 0);
> +
> + cell->bytes = (p - (u8 *)buf) + 1;
cell bytes can only be updated during parsing time not during every
access time.
--srini> }
>
> static int __nvmem_cell_read(struct nvmem_device *nvmem,
next prev parent reply other threads:[~2025-11-10 8:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-30 14:22 [PATCH v1] nvmem: core: update cell->bytes after shifting bits Emil Renner Berthing
2025-11-10 8:32 ` Srinivas Kandagatla [this message]
2025-11-13 11:36 ` Emil Renner Berthing
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=3951551f-02e9-41a3-8212-ac1cbaecc69a@kernel.org \
--to=srini@kernel.org \
--cc=emil.renner.berthing@canonical.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lumag@kernel.org \
--cc=samuel@sholland.org \
/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