[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231028-imx214-v2-5-69a8fb730d6e@apitzsch.eu>
Date: Sat, 28 Oct 2023 09:17:48 +0200
From: André Apitzsch <git@...tzsch.eu>
To: Ricardo Ribalda <ribalda@...nel.org>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>
Cc: Kieran Bingham <kieran.bingham@...asonboard.com>,
Jacopo Mondi <jacopo.mondi@...asonboard.com>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
~postmarketos/upstreaming@...ts.sr.ht,
André Apitzsch <git@...tzsch.eu>
Subject: [PATCH v2 5/5] media: i2c: imx214: Fix cleanup after controls
initialization error
If the controls are initialized incorrectly, don't destroy the mutex not
initialized yet and don't free controls as that is handled in
imx214_ctrls_init().
Signed-off-by: André Apitzsch <git@...tzsch.eu>
---
drivers/media/i2c/imx214.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c
index e0d9624a9d3f..0aba28d6dc2f 100644
--- a/drivers/media/i2c/imx214.c
+++ b/drivers/media/i2c/imx214.c
@@ -1069,7 +1069,7 @@ static int imx214_probe(struct i2c_client *client)
ret = imx214_ctrls_init(imx214);
if (ret < 0)
- goto free_ctrl;
+ goto error_power_off;
mutex_init(&imx214->mutex);
imx214->ctrls.lock = &imx214->mutex;
@@ -1100,6 +1100,7 @@ static int imx214_probe(struct i2c_client *client)
free_ctrl:
mutex_destroy(&imx214->mutex);
v4l2_ctrl_handler_free(&imx214->ctrls);
+error_power_off:
pm_runtime_disable(imx214->dev);
return ret;
--
2.42.0
Powered by blists - more mailing lists