f9532f39c35bacc442e7d9476af0d9709b5ecf1e
[openwrt/staging/blogic.git] /
1 From 104af6a5b199eb4dc7970d1304aef38ac5a6ed54 Mon Sep 17 00:00:00 2001
2 From: Miquel Raynal <miquel.raynal@bootlin.com>
3 Date: Tue, 8 Aug 2023 08:29:26 +0200
4 Subject: [PATCH] nvmem: core: Create all cells before adding the nvmem device
5
6 Let's pack all the cells creation in one place, so they are all created
7 before we add the nvmem device.
8
9 Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
10 Reviewed-by: Michael Walle <michael@walle.cc>
11 Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
12 ---
13 drivers/nvmem/core.c | 10 +++++-----
14 1 file changed, 5 insertions(+), 5 deletions(-)
15
16 --- a/drivers/nvmem/core.c
17 +++ b/drivers/nvmem/core.c
18 @@ -998,17 +998,17 @@ struct nvmem_device *nvmem_register(cons
19 if (rval)
20 goto err_remove_cells;
21
22 - dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name);
23 -
24 - rval = device_add(&nvmem->dev);
25 + rval = nvmem_add_cells_from_fixed_layout(nvmem);
26 if (rval)
27 goto err_remove_cells;
28
29 - rval = nvmem_add_cells_from_fixed_layout(nvmem);
30 + rval = nvmem_add_cells_from_layout(nvmem);
31 if (rval)
32 goto err_remove_cells;
33
34 - rval = nvmem_add_cells_from_layout(nvmem);
35 + dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name);
36 +
37 + rval = device_add(&nvmem->dev);
38 if (rval)
39 goto err_remove_cells;
40