[PATCH] media: mt9t112: fix error handling in mt9t112_camera_probe
From: Vitalii Mordan
Date: Mon Jan 13 2025 - 05:19:33 EST
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@xxxxxxxxxxxxxxx
Signed-off-by: Vitalii Mordan <mordan@xxxxxxxxx>
---
drivers/media/i2c/mt9t112.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
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:
--
2.25.1