Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Saikiran <bjsaikiran@gmail.com>
To: linux-media@vger.kernel.org
Cc: linux-arm-msm@vger.kernel.org, rfoss@kernel.org,
	todor.too@gmail.com, bryan.odonoghue@linaro.org, bod@kernel.org,
	vladimir.zapolskiy@linaro.org, hansg@kernel.org,
	sakari.ailus@linux.intel.com, mchehab@kernel.org,
	Saikiran <bjsaikiran@gmail.com>,
	stable@vger.kernel.org
Subject: [PATCH v2 2/2] media: i2c: ov02c10: Check for errors in disable_streams
Date: Sun, 25 Jan 2026 22:47:45 +0530	[thread overview]
Message-ID: <20260125171745.484806-3-bjsaikiran@gmail.com> (raw)
In-Reply-To: <20260125171745.484806-1-bjsaikiran@gmail.com>

The ov02c10_disable_streams() function ignores the return value from
cci_write() when stopping the sensor. If the I2C write fails (e.g.,
due to CCI timeout, power management race, or device removal), the
error is silently lost.

While we still need to return 0 and call pm_runtime_put() regardless
of hardware state (to prevent PM reference leaks and pipeline lock
issues), we should at least log when the hardware stop fails.

This change:
1. Captures the cci_write() return value
2. Logs an error if the write fails
3. Still returns 0 to ensure proper cleanup

Returning an error from disable_streams would cause the camss driver's
video_stop_streaming() to exit early without releasing the pipeline
lock, permanently locking the camera.

Fixes: 0e98938b0157 ("media: i2c: add OmniVision OV02C10 sensor driver")
Cc: stable@vger.kernel.org
Signed-off-by: Saikiran <bjsaikiran@gmail.com>
---
 drivers/media/i2c/ov02c10.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/ov02c10.c b/drivers/media/i2c/ov02c10.c
index b86cae3d2b74..743d8544ac53 100644
--- a/drivers/media/i2c/ov02c10.c
+++ b/drivers/media/i2c/ov02c10.c
@@ -629,8 +629,12 @@ static int ov02c10_disable_streams(struct v4l2_subdev *sd,
 				   u32 pad, u64 streams_mask)
 {
 	struct ov02c10 *ov02c10 = to_ov02c10(sd);
+	int ret;
+
+	ret = cci_write(ov02c10->regmap, OV02C10_REG_STREAM_CONTROL, 0, NULL);
+	if (ret)
+		dev_err(ov02c10->dev, "failed to stop streaming: %d\n", ret);
 
-	cci_write(ov02c10->regmap, OV02C10_REG_STREAM_CONTROL, 0, NULL);
 	pm_runtime_put(ov02c10->dev);
 
 	return 0;
-- 
2.51.0


  parent reply	other threads:[~2026-01-25 17:18 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-25 17:17 [PATCH v2 0/2] Fix OV02C10 camera pipeline lock issues Saikiran
2026-01-25 17:17 ` [PATCH v2 1/2] media: qcom: camss: Fix pipeline lock leak in stop_streaming Saikiran
2026-01-25 17:17 ` Saikiran [this message]
2026-01-26 10:13   ` [PATCH v2 2/2] media: i2c: ov02c10: Check for errors in disable_streams Konrad Dybcio
2026-01-26 10:21   ` Hans de Goede
2026-01-26  6:15 ` [PATCH v2 0/1] media: i2c: ov02c10: Keep power on and use reset for power management Saikiran
2026-01-26  6:15   ` [PATCH v2 1/1] " Saikiran
2026-01-26 10:32     ` Hans de Goede
2026-01-26 10:59       ` Saikiran B
2026-01-26 11:09     ` Bryan O'Donoghue
2026-01-26 11:23       ` Saikiran B
2026-01-26 11:41         ` Bryan O'Donoghue
2026-01-26 11:58           ` Saikiran B
2026-01-26 12:06             ` Bryan O'Donoghue
2026-01-26 12:24               ` Saikiran B
2026-01-26 12:41                 ` Bryan O'Donoghue
2026-01-26 12:48                   ` Saikiran B
2026-01-26 13:31                     ` Hans de Goede
     [not found]                       ` <I-1OPz69QKXF-LDqvufQARvv_3TIYaLyZIETdiGvSj_JSYhnJNeqiLERDUH2R0kclFyo6MqMRsaiZaS3RKmdZA==@protonmail.internalid>
     [not found]                         ` <CAAFDt1ufYyM4_xTy+AZTdXBB0cGNk+nFQHD5+5U7tUMQqZ+o=g@mail.gmail.com>
2026-01-26 15:04                           ` Bryan O'Donoghue
2026-01-26 15:40                             ` Saikiran B
2026-01-26 16:00                               ` Bryan O'Donoghue

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260125171745.484806-3-bjsaikiran@gmail.com \
    --to=bjsaikiran@gmail.com \
    --cc=bod@kernel.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=hansg@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rfoss@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=stable@vger.kernel.org \
    --cc=todor.too@gmail.com \
    --cc=vladimir.zapolskiy@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox