[PATCH master 3/7] nvmem: startfive-otp: correct regmap's max_register

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


The max_register must be a multiple of the register stride, which is not
the case for 0x200 - 1 == 0x1ff. Instead, we should be setting
(0x1ff * 4), so fix the calculation to do this.

Fixes: 88f3d13bafc6 ("nvmem: add StarFive OTP support")
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/nvmem/starfive-otp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvmem/starfive-otp.c b/drivers/nvmem/starfive-otp.c
index d22350b10ef2..47b94b1399a7 100644
--- a/drivers/nvmem/starfive-otp.c
+++ b/drivers/nvmem/starfive-otp.c
@@ -172,7 +172,7 @@ static int starfive_otp_probe(struct device *dev)
 	config.reg_bits = 32;
 	config.val_bits = 32;
 	config.reg_stride = 4;
-	config.max_register = total_fuses;
+	config.max_register = (total_fuses - 1) * config.reg_stride;
 
 	priv = xzalloc(sizeof(*priv));
 
-- 
2.39.2




More information about the barebox mailing list