From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 968E321B191; Mon, 26 Jan 2026 10:18:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769422701; cv=none; b=eI+hxwLe+8k+PbknYYmXwUXLAohKV/gcNN8pQbqKbuZqCiczcA1z/w9m8s6ijpW4bS8R2gyIMh+i6JhrcdC+AgDpLHndzrwshJd8SONhAaFrdxh9zGXPYC0kxtVgs3fUDqsS2WisPZdwLgazBh8oO2E+0VkYLceMu1JHpDKW37E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769422701; c=relaxed/simple; bh=SLn0xfRQuWOUiyd56GYWDPjUlG0vLuaDEWo/7BKo5Eg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=M25h/d2V3vTDAC6z+WgleZhYSxXvGE/kzlyjqMNT/ZzJImTgPBKAR5SE8CcyAAvtCQHjNV1383TMlrU1cI5RdaejJCCiZGfsvmGQUkvB+XB9kbQAO0Dr/lVs1WQ55RUfp9WkBwMDi1DLevdavoIAaJiUY9PcZDQ6iRb/IsCnj1I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=USnd+ZB7; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="USnd+ZB7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25488C116C6; Mon, 26 Jan 2026 10:18:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1769422701; bh=SLn0xfRQuWOUiyd56GYWDPjUlG0vLuaDEWo/7BKo5Eg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=USnd+ZB7rPA2rhPH/Qx2w/FdVCuTD1HaazAXbKPcA//gBJmpPacAgznCOmw72006B 3n0+zQ3PgDpvoHxQoEzVOWF10210O4L0WM1EGA1PyodI8ZPTUwgT77FF9WHYHc++aW 0AS4J/xt2NMI9GvlMCpGkZhaBH8rbkoGpkdzVskuVtcR60tj/U++6RN3Gj0Amcxez5 4FS9wBligaU9wtuo7tFsASjgTbtODijs59gA2Om6jA5MkLD7XCBZEYJiEP5flKeAkT LfgMXpRmXFyxaSGHCFvjY+IVnaJT6pgs4RfGbY7ogj/FUtSB2hP4mQ5SKGn15PjJk9 tq3ljtkLUvQBg== Message-ID: Date: Mon, 26 Jan 2026 11:18:17 +0100 Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] media: i2c: ov02c10: Check for errors in disable_streams To: Saikiran , 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 References: <20260124071751.5885-1-bjsaikiran@gmail.com> <20260124071751.5885-3-bjsaikiran@gmail.com> From: Hans de Goede Content-Language: en-US, nl In-Reply-To: <20260124071751.5885-3-bjsaikiran@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 > --- > 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