]> git.baikalelectronics.ru Git - kernel.git/commit
misc: eeprom: at24: fix regulator underflow
authorMichael Auchter <michael.auchter@ni.com>
Tue, 10 Mar 2020 20:58:40 +0000 (15:58 -0500)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Thu, 12 Mar 2020 08:02:34 +0000 (09:02 +0100)
commitfa55f07d83bb760b3e6c17a85b6626eeb0816df2
treee0585b9a02d5e3a99208e7c0ff8ef399e111bcd6
parentc60a8cd31b97a8e7dededd29dfc7803b6a28a358
misc: eeprom: at24: fix regulator underflow

The at24 driver attempts to read a byte from the device to validate that
it's actually present, and if not, disables the vcc regulator and
returns -ENODEV. However, between the read and the error handling path,
pm_runtime_idle() is called and invokes the driver's suspend callback,
which also disables the vcc regulator. This leads to an underflow of the
regulator enable count if the EEPROM is not present.

Move the pm_runtime_suspend() call to be after the error handling path
to resolve this.

Fixes: 706d3fa891da ("misc: eeprom: at24: support pm_runtime control")
Signed-off-by: Michael Auchter <michael.auchter@ni.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
drivers/misc/eeprom/at24.c