[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <83194335554146efc52c331993f083bd765db6f9.1730205085.git.christophe.jaillet@wanadoo.fr>
Date: Tue, 29 Oct 2024 13:31:49 +0100
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Thomas Richard <thomas.richard@...tlin.com>,
Lee Jones <lee@...nel.org>
Cc: linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org,
Christophe JAILLET <christophe.jaillet@...adoo.fr>
Subject: [PATCH v2] 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@...adoo.fr>
Reviewed-by: Thomas Richard <thomas.richard@...tlin.com>
---
Compile tested only
Changes in v2:
- remove an empty line [Thomas Richard]
- Add R-b tag
v1: https://lore.kernel.org/all/24ec1348b99e76a853435ab081ae9a8f0e51fd52.1729938747.git.christophe.jaillet@wanadoo.fr/
---
drivers/mfd/cgbc-core.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/cgbc-core.c b/drivers/mfd/cgbc-core.c
index 93004a6b29c1..7c0ee6d53091 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)
--
2.47.0
Powered by blists - more mailing lists