From: Hans de Goede <hansg@kernel.org>
To: Saikiran <bjsaikiran@gmail.com>, 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, sakari.ailus@linux.intel.com,
mchehab@kernel.org
Subject: Re: [PATCH] media: i2c: ov02c10: Check for errors in disable_streams
Date: Mon, 26 Jan 2026 11:18:17 +0100 [thread overview]
Message-ID: <fe96c6bb-08c9-443b-afa7-ba5e59b9a1cb@kernel.org> (raw)
In-Reply-To: <20260124071751.5885-3-bjsaikiran@gmail.com>
Hi,
On 24-Jan-26 08:17, Saikiran wrote:
> 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 (see commit 044f54e7c).
>
> Related-to: commit 7673f757858c ("media: i2c: ov02c10: Fix race condition in remove and relax reset timings")
> Signed-off-by: Saikiran <bjsaikiran@gmail.com>
> ---
> drivers/media/i2c/ov02c10.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/i2c/ov02c10.c b/drivers/media/i2c/ov02c10.c
> index b86cae3d2b74..db191dccff75 100644
> --- a/drivers/media/i2c/ov02c10.c
> +++ b/drivers/media/i2c/ov02c10.c
> @@ -629,10 +629,20 @@ 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);
cci_write() already logs a message on errors itself, so this is
undesirable as it will lead to duplicate log messages.
> pm_runtime_put(ov02c10->dev);
>
> + /*
> + * Return 0 even if cci_write failed. The stream is being stopped,
> + * so we must release the PM runtime reference regardless of hardware
> + * state. Returning an error here would cause pipeline lock leaks in
> + * the camss driver.
> + */
And as Brian stated such a big comment is not really necessary. disable_streams()
always returning 0 is normal and at some point we really ought to just make
its return-type "void".
So neither change is necessary here and this patch should be dropped.
Regards,
Hans
next prev parent reply other threads:[~2026-01-26 10:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-24 7:17 [PATCH 0/3] Fix OV02C10 camera stability on Snapdragon X Elite Saikiran
2026-01-24 7:17 ` [PATCH] media: qcom: camss: Fix pipeline lock leak in stop_streaming Saikiran
2026-01-25 12:23 ` Bryan O'Donoghue
2026-01-24 7:17 ` [PATCH] media: i2c: ov02c10: Check for errors in disable_streams Saikiran
2026-01-25 12:26 ` Bryan O'Donoghue
2026-01-26 10:18 ` Hans de Goede [this message]
2026-01-24 7:17 ` [PATCH] media: i2c: ov02c10: Enforce cool-down period to prevent brownout Saikiran
2026-01-25 13:21 ` 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=fe96c6bb-08c9-443b-afa7-ba5e59b9a1cb@kernel.org \
--to=hansg@kernel.org \
--cc=bjsaikiran@gmail.com \
--cc=bod@kernel.org \
--cc=bryan.odonoghue@linaro.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=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