diff options
author | Miquel Raynal <miquel.raynal@bootlin.com> | 2023-08-23 15:27:41 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-08-23 16:34:02 +0200 |
commit | f4d1d17e1d81096b43dd7d4ccab05494a44d7089 (patch) | |
tree | 6b0412bcc33a8f47c77a0c3ece16f15343d09b46 /drivers/nvmem | |
parent | nvmem: u-boot-env:: Replace zero-length array with DECLARE_FLEX_ARRAY() helper (diff) | |
download | linux-f4d1d17e1d81096b43dd7d4ccab05494a44d7089.tar.xz linux-f4d1d17e1d81096b43dd7d4ccab05494a44d7089.zip |
nvmem: core: Create all cells before adding the nvmem device
Let's pack all the cells creation in one place, so they are all created
before we add the nvmem device.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Michael Walle <michael@walle.cc>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230823132744.350618-20-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/nvmem')
-rw-r--r-- | drivers/nvmem/core.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 2251103b2c5f..bc7ea001a446 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -997,17 +997,17 @@ 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); + rval = nvmem_add_cells_from_fixed_layout(nvmem); if (rval) goto err_remove_cells; - rval = nvmem_add_cells_from_fixed_layout(nvmem); + rval = nvmem_add_cells_from_layout(nvmem); if (rval) goto err_remove_cells; - rval = nvmem_add_cells_from_layout(nvmem); + dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name); + + rval = device_add(&nvmem->dev); if (rval) goto err_remove_cells; |