diff options
author | Guenter Roeck <linux@roeck-us.net> | 2014-12-04 12:58:15 -0500 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2014-12-05 13:18:02 -0500 |
commit | 4ad40cc568c5537de11092d3362f9cb287f915d9 (patch) | |
tree | d645f9b83c36b6aa231740ab1f8926f2158f7c99 | |
parent | b95579cd8795442e75c8846fa6eeb4fb442e9d83 (diff) |
hwmon: (lm75) Strengthen detect function
A chip returning 0x00 in all registers is erroneously detected
as LM75. Check hysteresis and temperature limit registers and
abort if both are 0 to reduce the likelyhood for this to happen.
Reviewed-by: Rob Coulson <rob.coulson@gmail.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r-- | drivers/hwmon/lm75.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index f58439b817b5..6753fd940c76 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c | |||
@@ -415,6 +415,12 @@ static int lm75_detect(struct i2c_client *new_client, | |||
415 | || i2c_smbus_read_byte_data(new_client, 7) != os) | 415 | || i2c_smbus_read_byte_data(new_client, 7) != os) |
416 | return -ENODEV; | 416 | return -ENODEV; |
417 | } | 417 | } |
418 | /* | ||
419 | * It is very unlikely that this is a LM75 if both | ||
420 | * hysteresis and temperature limit registers are 0. | ||
421 | */ | ||
422 | if (hyst == 0 && os == 0) | ||
423 | return -ENODEV; | ||
418 | 424 | ||
419 | /* Addresses cycling */ | 425 | /* Addresses cycling */ |
420 | for (i = 8; i <= 248; i += 40) { | 426 | for (i = 8; i <= 248; i += 40) { |