* [PATCH] media: i2c: ov772x: power off sensor on ID read errors
@ 2026-09-13 1:43 Myeonghun Pak
0 siblings, 0 replies; only message in thread
From: Myeonghun Pak @ 2026-09-13 1:43 UTC (permalink / raw)
To: Jacopo Mondi, Sakari Ailus, Mauro Carvalho Chehab
Cc: Akinobu Mita, linux-media, linux-kernel, stable, Ijae Kim
ov772x_video_probe() powers on the sensor before reading the product and
manufacturer IDs. Since the register read error checks were added, any read
failure returns directly and leaves the clock enabled and the powerdown
GPIO asserted.
Route those failures through the existing power-off path. This covers the
old OV7720 and OV7725 sensors while preserving the direct return when
power-on itself fails, the product-ID mismatch path, and control setup
behavior.
This issue was identified during our ongoing static-analysis research while
reviewing kernel code.
Fixes: 30f3b17eaf49 ("media: ov772x: add checks for register read errors")
Cc: stable@vger.kernel.org
Assisted-by: OpenAI:GPT-5.6
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
drivers/media/i2c/ov772x.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/media/i2c/ov772x.c b/drivers/media/i2c/ov772x.c
index be3ba284ee..e20a109d60 100644
--- a/drivers/media/i2c/ov772x.c
+++ b/drivers/media/i2c/ov772x.c
@@ -1280,10 +1280,10 @@ static int ov772x_video_probe(struct ov772x_priv *priv)
/* Check and show product ID and manufacturer ID. */
ret = regmap_read(priv->regmap, PID, &pid);
if (ret < 0)
- return ret;
+ goto done;
ret = regmap_read(priv->regmap, VER, &ver);
if (ret < 0)
- return ret;
+ goto done;
switch (VERSION(pid, ver)) {
case OV7720:
@@ -1301,10 +1301,10 @@ static int ov772x_video_probe(struct ov772x_priv *priv)
ret = regmap_read(priv->regmap, MIDH, &midh);
if (ret < 0)
- return ret;
+ goto done;
ret = regmap_read(priv->regmap, MIDL, &midl);
if (ret < 0)
- return ret;
+ goto done;
dev_info(&client->dev,
"%s Product ID %0x:%0x Manufacturer ID %x:%x\n",
--
2.47.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-13 1:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-13 1:43 [PATCH] media: i2c: ov772x: power off sensor on ID read errors Myeonghun Pak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®