Skip to contentSkip to conversation

hwmon: (lm95241) Fix chip detection code

PATCH In review Guenter Roeck 2 participants 2 messages Jul 7, 2011 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 hwmon: (lm95241) Fix chip detection code

The LM95241 driver accepts every chip ID equal to or larger than 0xA4 as its own, and other chips such as LM95245 use chip IDs in the accepted ID range. This results in false chip detection.

Fix problem by accepting only the known LM95241 chip ID.

---
Candidate for -stable.

 drivers/hwmon/lm95241.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/lm95241.c +1 -1
index 1a6dfb6..01c638e 100644
@@ -339,7 +339,7 @@ static int lm95241_detect(struct i2c_client *new_client,
 	if ((i2c_smbus_read_byte_data(new_client, LM95241_REG_R_MAN_ID)
 	     = MANUFACTURER_ID)
 	    && (i2c_smbus_read_byte_data(new_client, LM95241_REG_R_CHIP_ID)
-		>= DEFAULT_REVISION)) {
+		= DEFAULT_REVISION)) {
 		name = DEVNAME;
 	} else {
 		dev_dbg(&adapter->dev, "LM95241 detection failed at 0x%02x\n",
Signature · 7 lines
1.7.3.1


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Acked-by on v2 1/3
#1 lore raw

Re: [lm-sensors] [PATCH v2 1/3] hwmon: (lm95241) Fix chip detection

Quoted 7 lines · Guenter Roeck

The LM95241 driver accepts every chip ID equal to or larger than 0xA4 as its own, and other chips such as LM95245 use chip IDs in the accepted ID range. This results in false chip detection.

Fix problem by accepting only the known LM95241 chip ID.

Quoted 2 lines

---
Candidate for -stable.

Definitely.

Quoted 17 lines
 drivers/hwmon/lm95241.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/lm95241.c +1 -1
index 1a6dfb6..01c638e 100644
@@ -339,7 +339,7 @@ static int lm95241_detect(struct i2c_client *new_client,
 	if ((i2c_smbus_read_byte_data(new_client, LM95241_REG_R_MAN_ID)
 	     = MANUFACTURER_ID)
 	    && (i2c_smbus_read_byte_data(new_client, LM95241_REG_R_CHIP_ID)
-		>= DEFAULT_REVISION)) {
+		= DEFAULT_REVISION)) {
 		name = DEVNAME;
 	} else {
 		dev_dbg(&adapter->dev, "LM95241 detection failed at 0x%02x\n",
Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors