From dc71afe5ac7e8d049bb991330518e4c898a7d92e Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 5 Mar 2010 22:17:26 +0100 Subject: 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 Signed-off-by: Jean Delvare Cc: Hans de Goede Cc: Andre Prendel Cc: stable@kernel.org --- drivers/hwmon/tmp401.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'drivers/hwmon/tmp401.c') diff --git a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c index a13b30e8d8d..d14a1af9f55 100644 --- a/drivers/hwmon/tmp401.c +++ b/drivers/hwmon/tmp401.c @@ -134,7 +134,7 @@ struct tmp401_data { struct mutex update_lock; char valid; /* zero until following fields are valid */ unsigned long last_updated; /* in jiffies */ - int kind; + enum chips kind; /* register values */ u8 status; @@ -524,7 +524,7 @@ static int tmp401_detect(struct i2c_client *client, if (reg > 15) return -ENODEV; - strlcpy(info->type, tmp401_id[kind - 1].name, I2C_NAME_SIZE); + strlcpy(info->type, tmp401_id[kind].name, I2C_NAME_SIZE); return 0; } @@ -572,8 +572,7 @@ static int tmp401_probe(struct i2c_client *client, goto exit_remove; } - dev_info(&client->dev, "Detected TI %s chip\n", - names[data->kind - 1]); + dev_info(&client->dev, "Detected TI %s chip\n", names[data->kind]); return 0; -- cgit v1.2.3-70-g09d2