From: Sasha Levin Date: Mon, 27 Dec 2021 03:37:36 +0000 (-0500) Subject: Fixes for 4.4 X-Git-Tag: v4.4.297~38 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e81d384d9ef42fb0a69cf7c8f0e13de9cbca29bb;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.4 Signed-off-by: Sasha Levin --- diff --git a/queue-4.4/hwmon-lm90-fix-usage-of-config2-register-in-detect-f.patch b/queue-4.4/hwmon-lm90-fix-usage-of-config2-register-in-detect-f.patch new file mode 100644 index 00000000000..e4201cca903 --- /dev/null +++ b/queue-4.4/hwmon-lm90-fix-usage-of-config2-register-in-detect-f.patch @@ -0,0 +1,50 @@ +From 9793780fa35bc8ad39bc284fc66cb1ed6e1f0ce1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 6 Nov 2021 10:02:44 -0700 +Subject: hwmon: (lm90) Fix usage of CONFIG2 register in detect function + +From: Guenter Roeck + +[ 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 +Signed-off-by: Sasha Levin +--- + drivers/hwmon/lm90.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +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 */ +-- +2.34.1 + diff --git a/queue-4.4/series b/queue-4.4/series index 489267dd219..286fc2b64a9 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -5,3 +5,4 @@ ib-qib-fix-memory-leak-in-qib_user_sdma_queue_pkts.patch qlcnic-potential-dereference-null-pointer-of-rx_queu.patch bonding-fix-ad_actor_system-option-setting-to-defaul.patch drivers-net-smc911x-check-for-error-irq.patch +hwmon-lm90-fix-usage-of-config2-register-in-detect-f.patch