aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/tmp401.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2010-03-05 16:17:26 -0500
committerJean Delvare <khali@linux-fr.org>2010-03-05 16:17:26 -0500
commitdc71afe5ac7e8d049bb991330518e4c898a7d92e (patch)
treed4062a740a4a287a933483a74c3393ddea67821d /drivers/hwmon/tmp401.c
parenta44908d742a577fb5ccb9a8c082326d4cea234c2 (diff)
hwmon: Fix off-by-one kind values
Recent changes on the I2C front have left off-by-one array indexes in 3 hwmon drivers. Fix them. Faulty commit: e5e9f44c2 i2c: Drop I2C_CLIENT_INSMOD_2 to 8 Reported-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Andre Prendel <andre.prendel@gmx.de> Cc: stable@kernel.org
Diffstat (limited to 'drivers/hwmon/tmp401.c')
-rw-r--r--drivers/hwmon/tmp401.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c
index a13b30e8d8d8..d14a1af9f550 100644
--- a/drivers/hwmon/tmp401.c
+++ b/drivers/hwmon/tmp401.c
@@ -134,7 +134,7 @@ struct tmp401_data {
134 struct mutex update_lock; 134 struct mutex update_lock;
135 char valid; /* zero until following fields are valid */ 135 char valid; /* zero until following fields are valid */
136 unsigned long last_updated; /* in jiffies */ 136 unsigned long last_updated; /* in jiffies */
137 int kind; 137 enum chips kind;
138 138
139 /* register values */ 139 /* register values */
140 u8 status; 140 u8 status;
@@ -524,7 +524,7 @@ static int tmp401_detect(struct i2c_client *client,
524 if (reg > 15) 524 if (reg > 15)
525 return -ENODEV; 525 return -ENODEV;
526 526
527 strlcpy(info->type, tmp401_id[kind - 1].name, I2C_NAME_SIZE); 527 strlcpy(info->type, tmp401_id[kind].name, I2C_NAME_SIZE);
528 528
529 return 0; 529 return 0;
530} 530}
@@ -572,8 +572,7 @@ static int tmp401_probe(struct i2c_client *client,
572 goto exit_remove; 572 goto exit_remove;
573 } 573 }
574 574
575 dev_info(&client->dev, "Detected TI %s chip\n", 575 dev_info(&client->dev, "Detected TI %s chip\n", names[data->kind]);
576 names[data->kind - 1]);
577 576
578 return 0; 577 return 0;
579 578