media: i2c: ov772x: power off sensor on ID read errors
Subsystems (4)
PATCH 1/1 media: i2c: ov772x: power off sensor on ID read errors
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")
Assisted-by OpenAI:GPT-5.6
Co-developed-by Ijae Kim <[email protected]>
Signed-off-by Ijae Kim <[email protected]>
Signed-off-by Myeonghun Pak <[email protected]>
--- drivers/media/i2c/ov772x.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/i2c/ov772x.c +4 -4
@@ -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",
Signature · 1 line
2.47.1