summaryrefslogtreecommitdiff
path: root/drivers/mfd
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2024-10-29 13:31:49 +0100
committerLee Jones <lee@kernel.org>2024-11-05 16:13:47 +0000
commit5a700e77d6458e838b4882627771cc5f367827af (patch)
tree9a09ec1b2dd8ee07359335278e0b7685e77a99c2 /drivers/mfd
parent76c6217c31266e800b67a476bba59dfeb9858a90 (diff)
mfd: cgbc-core: Fix error handling paths in cgbc_init_device()
If an error occurs after a cgbc_session_request() call, it should be balanced by a corresponding cgbc_session_release(), as already done in the remove function. Fixes: 6f1067cfbee7 ("mfd: Add Congatec Board Controller driver") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Thomas Richard <thomas.richard@bootlin.com> Link: https://lore.kernel.org/r/83194335554146efc52c331993f083bd765db6f9.1730205085.git.christophe.jaillet@wanadoo.fr Signed-off-by: Lee Jones <lee@kernel.org>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/cgbc-core.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/mfd/cgbc-core.c b/drivers/mfd/cgbc-core.c
index ac3042fd5aa1..85283c8dde25 100644
--- a/drivers/mfd/cgbc-core.c
+++ b/drivers/mfd/cgbc-core.c
@@ -321,9 +321,18 @@ static int cgbc_init_device(struct cgbc_device_data *cgbc)
ret = cgbc_get_version(cgbc);
if (ret)
- return ret;
+ goto release_session;
+
+ ret = mfd_add_devices(cgbc->dev, -1, cgbc_devs, ARRAY_SIZE(cgbc_devs),
+ NULL, 0, NULL);
+ if (ret)
+ goto release_session;
- return mfd_add_devices(cgbc->dev, -1, cgbc_devs, ARRAY_SIZE(cgbc_devs), NULL, 0, NULL);
+ return 0;
+
+release_session:
+ cgbc_session_release(cgbc);
+ return ret;
}
static int cgbc_probe(struct platform_device *pdev)