hwmon: (lm75) Strengthen detect function
[firefly-linux-kernel-4.4.55.git] / drivers / hwmon / lm75.c
index f58439b817b5db244077c47a9dfbbdca99d62638..6753fd940c7623a0fbbd2790c7b7bf5af43f2a18 100644 (file)
@@ -415,6 +415,12 @@ static int lm75_detect(struct i2c_client *new_client,
                 || i2c_smbus_read_byte_data(new_client, 7) != os)
                        return -ENODEV;
        }
+       /*
+        * It is very unlikely that this is a LM75 if both
+        * hysteresis and temperature limit registers are 0.
+        */
+       if (hyst == 0 && os == 0)
+               return -ENODEV;
 
        /* Addresses cycling */
        for (i = 8; i <= 248; i += 40) {