Skip to content

Commit 2962484

Browse files
hsinyi527gregkh
authored andcommitted
misc: eeprom: at24: check suspend status before disable regulator
cd5676d ("misc: eeprom: at24: support pm_runtime control") disables regulator in runtime suspend. If runtime suspend is called before regulator disable, it will results in regulator unbalanced disabling. Fixes: cd5676d ("misc: eeprom: at24: support pm_runtime control") Cc: stable <stable@vger.kernel.org> Acked-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org> Link: https://lore.kernel.org/r/20210420133050.377209-1-hsinyi@chromium.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0b0226b commit 2962484

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

drivers/misc/eeprom/at24.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,8 @@ static int at24_probe(struct i2c_client *client)
763763
at24->nvmem = devm_nvmem_register(dev, &nvmem_config);
764764
if (IS_ERR(at24->nvmem)) {
765765
pm_runtime_disable(dev);
766-
regulator_disable(at24->vcc_reg);
766+
if (!pm_runtime_status_suspended(dev))
767+
regulator_disable(at24->vcc_reg);
767768
return PTR_ERR(at24->nvmem);
768769
}
769770

@@ -774,7 +775,8 @@ static int at24_probe(struct i2c_client *client)
774775
err = at24_read(at24, 0, &test_byte, 1);
775776
if (err) {
776777
pm_runtime_disable(dev);
777-
regulator_disable(at24->vcc_reg);
778+
if (!pm_runtime_status_suspended(dev))
779+
regulator_disable(at24->vcc_reg);
778780
return -ENODEV;
779781
}
780782

0 commit comments

Comments
 (0)