Revert "nvmem: core: fix registration vs use race"
This reverts commit 2dcb474af1
which is
commit ab3428cfd9aa2f3463ee4b2909b5bb2193bd0c4a upstream.
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;
|
nvmem->dev.groups = nvmem_dev_groups;
|
||||||
#endif
|
#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) {
|
if (config->compat) {
|
||||||
rval = nvmem_sysfs_setup_compat(nvmem, config);
|
rval = nvmem_sysfs_setup_compat(nvmem, config);
|
||||||
if (rval)
|
if (rval)
|
||||||
goto err_put_device;
|
goto err_device_del;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config->cells) {
|
if (config->cells) {
|
||||||
@@ -702,12 +708,6 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
|
|||||||
if (rval)
|
if (rval)
|
||||||
goto err_remove_cells;
|
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);
|
blocking_notifier_call_chain(&nvmem_notifier, NVMEM_ADD, nvmem);
|
||||||
|
|
||||||
return nvmem;
|
return nvmem;
|
||||||
@@ -716,6 +716,8 @@ err_remove_cells:
|
|||||||
nvmem_device_remove_all_cells(nvmem);
|
nvmem_device_remove_all_cells(nvmem);
|
||||||
if (config->compat)
|
if (config->compat)
|
||||||
nvmem_sysfs_remove_compat(nvmem, config);
|
nvmem_sysfs_remove_compat(nvmem, config);
|
||||||
|
err_device_del:
|
||||||
|
device_del(&nvmem->dev);
|
||||||
err_put_device:
|
err_put_device:
|
||||||
put_device(&nvmem->dev);
|
put_device(&nvmem->dev);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user