kernel: fix possible mtd NULL pointer dereference
[openwrt/openwrt.git] / target / linux / generic / backport-5.10 / 872-v5.13-03-hwmon-tps23861-correct-shunt-LSB-values.patch
1 From b447e689a26614ce08a431e8000e8a650a63dcb3 Mon Sep 17 00:00:00 2001
2 From: Robert Marko <robert.marko@sartura.hr>
3 Date: Thu, 10 Jun 2021 00:07:28 +0200
4 Subject: [PATCH 4/4] hwmon: (tps23861) correct shunt LSB values
5
6 Current shunt LSB values got reversed during in the
7 original driver commit.
8
9 So, correct the current shunt LSB values according to
10 the datasheet.
11
12 This caused reading slightly skewed current values.
13
14 Fixes: fff7b8ab2255 ("hwmon: add Texas Instruments TPS23861 driver")
15 Signed-off-by: Robert Marko <robert.marko@sartura.hr>
16 Link: https://lore.kernel.org/r/20210609220728.499879-3-robert.marko@sartura.hr
17 Signed-off-by: Guenter Roeck <linux@roeck-us.net>
18 ---
19 drivers/hwmon/tps23861.c | 4 ++--
20 1 file changed, 2 insertions(+), 2 deletions(-)
21
22 --- a/drivers/hwmon/tps23861.c
23 +++ b/drivers/hwmon/tps23861.c
24 @@ -105,8 +105,8 @@
25 #define TEMPERATURE_LSB 652 /* 0.652 degrees Celsius */
26 #define VOLTAGE_LSB 3662 /* 3.662 mV */
27 #define SHUNT_RESISTOR_DEFAULT 255000 /* 255 mOhm */
28 -#define CURRENT_LSB_255 62260 /* 62.260 uA */
29 -#define CURRENT_LSB_250 61039 /* 61.039 uA */
30 +#define CURRENT_LSB_250 62260 /* 62.260 uA */
31 +#define CURRENT_LSB_255 61039 /* 61.039 uA */
32 #define RESISTANCE_LSB 110966 /* 11.0966 Ohm*/
33 #define RESISTANCE_LSB_LOW 157216 /* 15.7216 Ohm*/
34