linux-stable/drivers/hwmon/pmbus
Adam Wujek 1047d4ac66 hwmon: (pmbus) Check PEC support before reading other registers
[ Upstream commit d1baf7a3a3 ]

Make sure that the support of PEC is determined before the read of other
registers. Otherwise the validation of PEC can trigger an error on the read
of STATUS_BYTE or STATUS_WORD registers.

The problematic scenario is the following. A device with enabled PEC
support is up and running and a kernel driver is loaded.
Then the driver is unloaded (or device unbound), the HW device
is reconfigured externally (e.g. by i2cset) to advertise itself as not
supporting PEC. Without the move of the code, at the second load of
the driver (or bind) the STATUS_BYTE or STATUS_WORD register is always
read with PEC enabled, which is likely to cause a read error resulting
with fail of a driver load (or bind).

Signed-off-by: Adam Wujek <dev_public@wujek.eu>
Link: https://lore.kernel.org/r/20220519233334.438621-1-dev_public@wujek.eu
Fixes: 75d2b2b06b ("hwmon: (pmbus) disable PEC if not enabled")
Fixes: 4e5418f787 ("hwmon: (pmbus_core) Check adapter PEC support")
[groeck: Added Fixes: tags, dropped continuation line]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-06-09 10:23:02 +02:00
..
adm1266.c
adm1275.c
bel-pfe.c
bpa-rs600.c hwmon: (pmbus/bpa-rs600) Add workaround for incorrect Pin max 2021-08-17 14:54:27 -07:00
dps920ab.c hwmon: (pmbus/dps920ab) Delete some dead code 2021-06-18 12:45:58 -07:00
fsp-3y.c
ibm-cffps.c hwmon: (pmbus/ibm-cffps) max_power_out swap changes 2021-10-02 04:38:53 -07:00
inspur-ipsps.c
ir35221.c
ir36021.c
ir38064.c
irps5401.c
isl68137.c
Kconfig hwmon: (pmbus) Add driver for Delta DPS-920AB PSU 2021-06-17 04:21:46 -07:00
lm25066.c hwmon: (pmbus/lm25066) Let compiler determine outer dimension of lm25066_coeff 2021-11-18 19:16:32 +01:00
ltc2978.c
ltc3815.c
Makefile hwmon: (pmbus) Add driver for Delta DPS-920AB PSU 2021-06-17 04:21:46 -07:00
max8688.c
max15301.c
max16064.c
max16601.c
max20730.c
max20751.c
max31785.c
max34440.c
mp2888.c
mp2975.c hwmon: (pmbus/mp2975) Add missed POUT attribute for page 1 mp2975 controller 2021-10-02 04:45:49 -07:00
pim4328.c hwmon: (pmbus/pim4328) Add PMBus driver for PIM4006, PIM4328 and PIM4820 2021-06-17 04:21:46 -07:00
pm6764tr.c
pmbus.c
pmbus.h hwmon: (pmbus) Add Vin unit off handling 2022-04-08 14:23:09 +02:00
pmbus_core.c hwmon: (pmbus) Check PEC support before reading other registers 2022-06-09 10:23:02 +02:00
pxe1610.c
q54sj108a2.c
stpddc60.c
tps40422.c
tps53679.c
ucd9000.c
ucd9200.c
xdpe12284.c
zl6100.c