]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
nvmem: imx-ocotp-ele: fix reading from non zero offset
authorSascha Hauer <s.hauer@pengutronix.de>
Mon, 30 Dec 2024 14:18:57 +0000 (14:18 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Feb 2025 09:05:38 +0000 (10:05 +0100)
commit829421f1eaa294c46c94ebe5fb0182055a86c9e8
tree1c9be84c7d88850c6adb9436c800eb26eac03e07
parentca81889d66aac85fb4124bd0323059b8456395ca
nvmem: imx-ocotp-ele: fix reading from non zero offset

commit 3c9e2cb6cecf65f7501004038c5d1ed85fb7db84 upstream.

In imx_ocotp_reg_read() the offset comes in as bytes and not as words.
This means we have to divide offset by 4 to get to the correct word
offset.

Also the incoming offset might not be word aligned. In order to read
from the OCOTP the driver aligns down the previous word boundary and
reads from there. This means we have to skip this alignment offset from
the temporary buffer when copying the data to the output buffer.

Fixes: 22e9e6fcfb50 ("nvmem: imx: support i.MX93 OCOTP")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Cc: stable <stable@kernel.org>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20241230141901.263976-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nvmem/imx-ocotp-ele.c