Skip to content

Commit fa2e149

Browse files
groeckgregkh
authored andcommitted
hwmon: (lm90) Fix usage of CONFIG2 register in detect function
[ Upstream commit fce15c4 ] The detect function had a comment "Make compiler happy" when id did not read the second configuration register. As it turns out, the code was checking the contents of this register for manufacturer ID 0xA1 (NXP Semiconductor/Philips), but never actually read the register. So it wasn't surprising that the compiler complained, and it indeed had a point. Fix the code to read the register contents for manufacturer ID 0xa1. At the same time, the code was reading the register for manufacturer ID 0x41 (Analog Devices), but it was not using the results. In effect it was just checking if reading the register returned an error. That doesn't really add much if any value, so stop doing that. Fixes: f90be42 ("hwmon: (lm90) Refactor reading of config2 register") Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent ba696b4 commit fa2e149

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎drivers/hwmon/lm90.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,12 +1438,11 @@ static int lm90_detect(struct i2c_client *client,
14381438
if (man_id < 0 || chip_id < 0 || config1 < 0 || convrate < 0)
14391439
return -ENODEV;
14401440

1441-
if (man_id == 0x01 || man_id == 0x5C || man_id == 0x41) {
1441+
if (man_id == 0x01 || man_id == 0x5C || man_id == 0xA1) {
14421442
config2 = i2c_smbus_read_byte_data(client, LM90_REG_R_CONFIG2);
14431443
if (config2 < 0)
14441444
return -ENODEV;
1445-
} else
1446-
config2 = 0; /* Make compiler happy */
1445+
}
14471446

14481447
if ((address == 0x4C || address == 0x4D)
14491448
&& man_id == 0x01) { /* National Semiconductor */

0 commit comments

Comments
 (0)