Skip to contentSkip to conversation

hwmon: (adt7462) Wrong ADT7462_VOLT_COUNT

PATCH In review Jean Delvare 2 participants 2 messages Jan 29, 2010 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: (adt7462) Wrong ADT7462_VOLT_COUNT

From: Ray Copeland <[email protected]>
Subject: hwmon: (adt7462) Wrong ADT7462_VOLT_COUNT

The #define ADT7462_VOLT_COUNT is wrong, it should be 13 not 12. All the for loops that use this as a limit count are of the typical form, "for (n = 0; n < ADT7462_VOLT_COUNT; n++)", so to loop through all voltages w/o missing the last one it is necessary for the count to be one greater than it is. (Specifically, you will miss the +1.5V 3GPIO input with count = 12 vs. 13.)

---
 drivers/hwmon/adt7462.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/adt7462.c +1 -1
@@ -179,7 +179,7 @@ static const unsigned short normal_i2c[]
  *
  * Some, but not all, of these voltages have low/high limits.
  */
-#define ADT7462_VOLT_COUNT	12
+#define ADT7462_VOLT_COUNT	13
 
 #define ADT7462_VENDOR		0x41
 #define ADT7462_DEVICE		0x62
Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Jean Delvare

From: Ray Copeland <[email protected]>
Subject: hwmon: (adt7462) Wrong ADT7462_VOLT_COUNT

The #define ADT7462_VOLT_COUNT is wrong, it should be 13 not 12. All the for loops that use this as a limit count are of the typical form, "for (n = 0; n < ADT7462_VOLT_COUNT; n++)", so to loop through all voltages w/o missing the last one it is necessary for the count to be one greater than it is. (Specifically, you will miss the +1.5V 3GPIO input with count = 12 vs. 13.)

Quoted 4 lines

Oh yes, this patch. I recall discussing this one earlier, so:

--D

Quoted 19 lines
---
 drivers/hwmon/adt7462.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/adt7462.c +1 -1
@@ -179,7 +179,7 @@ static const unsigned short normal_i2c[]
  *
  * Some, but not all, of these voltages have low/high limits.
  */
-#define ADT7462_VOLT_COUNT	12
+#define ADT7462_VOLT_COUNT	13
 
 #define ADT7462_VENDOR		0x41
 #define ADT7462_DEVICE		0x62
Signature · 2 lines
-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors