summaryrefslogtreecommitdiff
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2015-02-27 08:23:37 -0800
committerGuenter Roeck <linux@roeck-us.net>2015-03-09 09:59:36 -0700
commit6552f327cab8eb6c773ba4f702cf6a371d1dc467 (patch)
tree53f25df93c54a20473fd53be4e92a195f7491391 /drivers/hwmon
parent9c947d25c96ec93485d60f7b783403d518c1418d (diff)
hwmon: (nct7904) Strengthen detect function
The bank register has five unused bits. Verify that those bits are zero to strengthen the detect function. Cc: Vadim V. Vlasov <vvlasov@dev.rtsoft.ru> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Jean Delvare <jdelvare@suse.de>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/nct7904.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/hwmon/nct7904.c b/drivers/hwmon/nct7904.c
index eaa8234e21d0..b77b82f24480 100644
--- a/drivers/hwmon/nct7904.c
+++ b/drivers/hwmon/nct7904.c
@@ -502,7 +502,8 @@ static int nct7904_detect(struct i2c_client *client,
/* Determine the chip type. */
if (i2c_smbus_read_byte_data(client, VENDOR_ID_REG) != NUVOTON_ID ||
i2c_smbus_read_byte_data(client, CHIP_ID_REG) != NCT7904_ID ||
- (i2c_smbus_read_byte_data(client, DEVICE_ID_REG) & 0xf0) != 0x50)
+ (i2c_smbus_read_byte_data(client, DEVICE_ID_REG) & 0xf0) != 0x50 ||
+ (i2c_smbus_read_byte_data(client, BANK_SEL_REG) & 0xf8) != 0x00)
return -ENODEV;
strlcpy(info->type, "nct7904", I2C_NAME_SIZE);