summaryrefslogtreecommitdiff
path: root/drivers/misc
diff options
context:
space:
mode:
authorWolfram Sang <wsa@kernel.org>2020-09-09 11:17:08 +0300
committerWolfram Sang <wsa@kernel.org>2020-09-09 11:17:08 +0300
commit0065ec0054be8da664ac0830bb887dd7574ed251 (patch)
tree796db87b9a0008f1cb666accbd654f1315e865ae /drivers/misc
parent06be67266a0c9a6a1ffb330a4ab50c2f21612e2b (diff)
parent45df80d7605c25055a85fbc5a8446c81c6c0ca24 (diff)
downloadlinux-0065ec0054be8da664ac0830bb887dd7574ed251.tar.xz
Merge tag 'at24-fixes-for-v5.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into i2c/for-current
at24 fixes for v5.9-rc5 - delay registration of the nvmem provider until after power is enabled
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/eeprom/at24.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 2591c21b2b5d..26a23abc053d 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -692,10 +692,6 @@ static int at24_probe(struct i2c_client *client)
nvmem_config.word_size = 1;
nvmem_config.size = byte_len;
- at24->nvmem = devm_nvmem_register(dev, &nvmem_config);
- if (IS_ERR(at24->nvmem))
- return PTR_ERR(at24->nvmem);
-
i2c_set_clientdata(client, at24);
err = regulator_enable(at24->vcc_reg);
@@ -708,6 +704,13 @@ static int at24_probe(struct i2c_client *client)
pm_runtime_set_active(dev);
pm_runtime_enable(dev);
+ at24->nvmem = devm_nvmem_register(dev, &nvmem_config);
+ if (IS_ERR(at24->nvmem)) {
+ pm_runtime_disable(dev);
+ regulator_disable(at24->vcc_reg);
+ return PTR_ERR(at24->nvmem);
+ }
+
/*
* Perform a one-byte test read to verify that the
* chip is functional.