diff mbox series

media: mt9t112: fix error handling in mt9t112_camera_probe

Message ID 20250113101914.2441210-1-mordan@ispras.ru
State New
Headers show
Series media: mt9t112: fix error handling in mt9t112_camera_probe | expand

Commit Message

Vitalii Mordan Jan. 13, 2025, 10:19 a.m. UTC
The macro mt9t112_reg_read returns from mt9t112_camera_probe() in case of
an error. However, a call to the shutdown function mt9t112_s_power() is
required at this point. Failure to execute the shutdown function will
result in the priv->clk not being properly disabled.

Found by Linux Verification Center (linuxtesting.org) with Klever.

Fixes: 858424b998ae ("V4L/DVB (13670): soc-camera: Add mt9t112 camera driver")
Cc: stable@vger.kernel.org
Signed-off-by: Vitalii Mordan <mordan@ispras.ru>
---
 drivers/media/i2c/mt9t112.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/media/i2c/mt9t112.c b/drivers/media/i2c/mt9t112.c
index 878dff9b7577..82e2c42f4c7b 100644
--- a/drivers/media/i2c/mt9t112.c
+++ b/drivers/media/i2c/mt9t112.c
@@ -1034,7 +1034,11 @@  static int mt9t112_camera_probe(struct i2c_client *client)
 		return ret;
 
 	/* Check and show chip ID. */
-	mt9t112_reg_read(chipid, client, 0x0000);
+	chipid = __mt9t112_reg_read(client, 0x0000);
+	if (chipid < 0) {
+		ret = chipid;
+		goto done;
+	}
 
 	switch (chipid) {
 	case 0x2680: