Patch "hwmon: (lm90) Fix usage of CONFIG2 register in detect function" has been added to the 4.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    hwmon: (lm90) Fix usage of CONFIG2 register in detect function

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     hwmon-lm90-fix-usage-of-config2-register-in-detect-f.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 9793780fa35bc8ad39bc284fc66cb1ed6e1f0ce1
Author: Guenter Roeck <linux@xxxxxxxxxxxx>
Date:   Sat Nov 6 10:02:44 2021 -0700

    hwmon: (lm90) Fix usage of CONFIG2 register in detect function
    
    [ Upstream commit fce15c45d3fbd9fc1feaaf3210d8e3f8b33dfd3a ]
    
    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: f90be42fb383 ("hwmon: (lm90) Refactor reading of config2 register")
    Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index c9ff08dbe10ce..420f341272621 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -1209,12 +1209,11 @@ static int lm90_detect(struct i2c_client *client,
 	if (man_id < 0 || chip_id < 0 || config1 < 0 || convrate < 0)
 		return -ENODEV;
 
-	if (man_id == 0x01 || man_id == 0x5C || man_id == 0x41) {
+	if (man_id == 0x01 || man_id == 0x5C || man_id == 0xA1) {
 		config2 = i2c_smbus_read_byte_data(client, LM90_REG_R_CONFIG2);
 		if (config2 < 0)
 			return -ENODEV;
-	} else
-		config2 = 0;		/* Make compiler happy */
+	}
 
 	if ((address == 0x4C || address == 0x4D)
 	 && man_id == 0x01) { /* National Semiconductor */



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux