Revert "nvmem: core: fix registration vs use race"
This reverts commit2dcb474af1which is commitab3428cfd9upstream. It breaks the Android kernel api, and isn't even really needed in the 5.10.y kernel tree yet, as there are no users of the new field. So revert it for now. If it is needed, it can be brought back in an abi-safe way in the future. Bug: 161946584 Change-Id: Ibff0d5602c36121fdb31767fd37a013bd26f94cb Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -682,10 +682,16 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
|
||||
nvmem->dev.groups = nvmem_dev_groups;
|
||||
#endif
|
||||
|
||||
dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name);
|
||||
|
||||
rval = device_add(&nvmem->dev);
|
||||
if (rval)
|
||||
goto err_put_device;
|
||||
|
||||
if (config->compat) {
|
||||
rval = nvmem_sysfs_setup_compat(nvmem, config);
|
||||
if (rval)
|
||||
goto err_put_device;
|
||||
goto err_device_del;
|
||||
}
|
||||
|
||||
if (config->cells) {
|
||||
@@ -702,12 +708,6 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
|
||||
if (rval)
|
||||
goto err_remove_cells;
|
||||
|
||||
dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name);
|
||||
|
||||
rval = device_add(&nvmem->dev);
|
||||
if (rval)
|
||||
goto err_remove_cells;
|
||||
|
||||
blocking_notifier_call_chain(&nvmem_notifier, NVMEM_ADD, nvmem);
|
||||
|
||||
return nvmem;
|
||||
@@ -716,6 +716,8 @@ err_remove_cells:
|
||||
nvmem_device_remove_all_cells(nvmem);
|
||||
if (config->compat)
|
||||
nvmem_sysfs_remove_compat(nvmem, config);
|
||||
err_device_del:
|
||||
device_del(&nvmem->dev);
|
||||
err_put_device:
|
||||
put_device(&nvmem->dev);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user