[PATCH master 4/7] nvmem: imx-ocotp-ele: correct regmap's max_register

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Jan 2 09:00:57 PST 2024


The max_register must be a multiple of the register stride, which is not
the case for 2048 - 1 == 2047. Instead, we should be setting 2044, so
fix the calculation to do this.

Fixes: e75746d53cca ("nvmem: Add support for i.MX ELE ocotp")
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/nvmem/imx-ocotp-ele.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvmem/imx-ocotp-ele.c b/drivers/nvmem/imx-ocotp-ele.c
index dbdb70d46fad..b748a30b1fc7 100644
--- a/drivers/nvmem/imx-ocotp-ele.c
+++ b/drivers/nvmem/imx-ocotp-ele.c
@@ -139,7 +139,7 @@ static int imx_ele_ocotp_probe(struct device *dev)
 	priv->map_config.reg_bits = 32;
 	priv->map_config.val_bits = 32;
 	priv->map_config.reg_stride = 4;
-	priv->map_config.max_register = priv->data->size - 1;
+	priv->map_config.max_register = priv->data->size - priv->map_config.reg_stride;
 
 	priv->map = regmap_init(dev, &imx_ocotp_regmap_bus, priv, &priv->map_config);
 	if (IS_ERR(priv->map))
-- 
2.39.2




More information about the barebox mailing list