Skip to contentSkip to conversation

regulator: pfuze100: Fix off-by-one for max_register setting

PATCH Applied Axel Lin 3 participants 3 messages Aug 1, 2013 – Aug 2, 2013 Voltage and current regulator framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 regulator: pfuze100: Fix off-by-one for max_register setting

max_register should be register count - 1.

---
Hi Robin,
I don't have the datasheet, can you check if this patch is correct or not? If PFUZE_NUMREGS really means register count, I think this fix is required.

Thanks,
Axel

 drivers/regulator/pfuze100-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/pfuze100-regulator.c +1 -1
index bda5561..ba67b2c 100644
@@ -332,7 +332,7 @@ static int pfuze_identify(struct pfuze_chip *pfuze_chip)
 static const struct regmap_config pfuze_regmap_config = {
 	.reg_bits = 8,
 	.val_bits = 8,
-	.max_register = PFUZE_NUMREGS,
+	.max_register = PFUZE_NUMREGS - 1,
 	.cache_type = REGCACHE_RBTREE,
 };
 
Signature · 1 line
1.8.1.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Axel Lin

max_register should be register count - 1.

---
Hi Robin,
I don't have the datasheet, can you check if this patch is correct or not? If PFUZE_NUMREGS really means register count, I think this fix is required.

Yes, you are right.

Thanks.

Quoted 24 lines

Thanks,
Axel

 drivers/regulator/pfuze100-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/pfuze100-regulator.c +1 -1
index bda5561..ba67b2c 100644
@@ -332,7 +332,7 @@ static int pfuze_identify(struct pfuze_chip *pfuze_chip)
 static const struct regmap_config pfuze_regmap_config = {
 	.reg_bits = 8,
 	.val_bits = 8,
-	.max_register = PFUZE_NUMREGS,
+	.max_register = PFUZE_NUMREGS - 1,
 	.cache_type = REGCACHE_RBTREE,
 };
 
Signature · 1 line
1.8.1.2