[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230301152239.531194-5-miquel.raynal@bootlin.com>
Date: Wed, 1 Mar 2023 16:22:35 +0100
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
<linux-kernel@...r.kernel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Michael Walle <michael@...le.cc>, devicetree@...r.kernel.org,
Rob Herring <robh+dt@...nel.org>,
Frank Rowand <frowand.list@...il.com>,
Robert Marko <robert.marko@...tura.hr>,
Luka Perkov <luka.perkov@...tura.hr>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
rafal@...ecki.pl, Miquel Raynal <miquel.raynal@...tlin.com>
Subject: [PATCH 4/8] nvmem: core: Fix error path ordering
The layout is being retrieved before the addition of nvmem cells and
after the creation of the sysfs entries. Soon the layout operation will
have the possibility to fail, hence adding a new goto label in the error
path. Before doing so, we need to fix the operation order in the error
path.
Signed-off-by: Miquel Raynal <miquel.raynal@...tlin.com>
---
drivers/nvmem/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 56b4b20a95a9..16044377a41d 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -975,9 +975,9 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
err_remove_cells:
nvmem_device_remove_all_cells(nvmem);
+ nvmem_layout_put(nvmem->layout);
if (config->compat)
nvmem_sysfs_remove_compat(nvmem, config);
- nvmem_layout_put(nvmem->layout);
err_put_device:
put_device(&nvmem->dev);
--
2.34.1
Powered by blists - more mailing lists