From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796392624; b=VOcql1GLx0DsqgJE4zLuthzsR/IqU2DQpzJPnSHIXKRgsw+Cq8j49lAz2o+5FBHIIkGd Am7fklp4W7PfSF4HFlAdwb1ZY04axo6qPtfdAbE6ISQv956js58dVMtUWFgg6JcvRDpdL ZhtWKsWNUW15JbpC4gtazZIm9r1n9+UUrgNe8v3D1arGlEKs76TJXXMBTrjUBHbTK8l+g h4q31u+w7zC5BHFVsDM8NhoKmUo/GuIu0Xf1L9yHoER8OEEjMl1SNhIVYsGyadENMahvN wthVOGUA+t6aH0m2hAKhZAZtVdGwJuNYH8SX7gHVSYtkMk0zeI8v/vUIOH1rbjD2m5w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796392624; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=TqiKqVXcAcfvzs90NLyNWsk9SfY+UQPvAWU3y8NOV9I=; b=IhIInXwJ2EHHNwCirlVrTGRpobSGGdToRjONxickN+upu2p77z5HlR4p9zHJ0+weBvbF vAYXeJkH7MxLSSsIE0NPByoGUtHXv4/Yg764PamsYxjVXT3MnJPXRxeNE51I+8AnxsI2I D3+B/JfX24TrGQoRQm2pdGVqET7L3ypFv4Xds9eqR+eW1pLebqcEX4bpGYnZc/66UQi1M ZWqcup99xnPsW1DtDV/D+44i0InAJZwfI1pDYlXD7sKA+m0KPYT+DmA5Tt4s+H9kTDhNq 2owR+F2DpA1MoI6+3WHORhufEl88FgNYEh1xMPPtsBioRpaIJqdOmLCt/3xE2LgKBWA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LaO5NR9Z; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A7453606A332 for ; Fri, 4 Dec 2026 13:57:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LaO5NR9Z Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B7D71F000CE; Fri, 4 Dec 2026 13:57:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796392624; bh=TqiKqVXcAcfvzs90NLyNWsk9SfY+UQPvAWU3y8NOV9I=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=LaO5NR9ZjZcJV0NW4zoVCxxIP1XgKDaCmd1D5FjDksrKfR9Ka/AWAwryXjVi1DbHg b+TKqQdK5/+weS3TWCdkpGDIa4CujONFVWGz/gldQaap+1YiBCGiNsKrpF5b1Ywi7t 6OLw1VMUqA1+fyv9Jslin0yxOAnZaMW2cY8GpQkpC9hDgRARlDdto4y0YeMi0JVxH5 DFRfHUmGy/ZDUaadsLy39YzMUM6qvIZfjlC7tKQxItM8rUAIWp0ZgJLdGXEf/D40EI bFwshNG1BZgYUvv8AR/BBZm9Vzu3sZ5zIqTYXCc2/GKj4uSaa6Ig00aPvyNR9Ggjkg UAYisgZppC+6A== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 2/2] media: i2c: add os05e10 image sensor driver Reply-To: sashiko-reviews@lists.linux.dev To: "Bhavin Sharma" Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org, media-ci@linuxtv.org In-Reply-To: <20261204132832.130979-3-bhavin.sharma@siliconsignals.io> References: <20261204132832.130979-1-bhavin.sharma@siliconsignals.io> <20261204132832.130979-3-bhavin.sharma@siliconsignals.io> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 13:57:03 +0000 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 7 potential issues to consider: - [Medium] media: i2c: os05e10: 32-bit integer overflow in os05e10_pixel_rate() - [Medium] media: i2c: os05e10: missing V4L2_CID_HBLANK control in os05e10_init_controls() - [Medium] media: i2c: os05e10: os05e10_disable_streams() desyncs stream state on error - [Medium] media: i2c: os05e10: Bayer format mismatch between commit message and code - [Medium] media: os05e10: unconditional os05e10_power_off() on probe error - [Low] media: i2c: os05e10: os05e10_set_pad_format() leaves ycbcr_enc/flags unset - [Low] media: i2c: os05e10: stray semicolon, unused code, and Kconfig indentation -- commit 71a3e0effda749e1cf7f74b7c3298d02c8541eec Author: Bhavin Sharma media: i2c: add os05e10 image sensor driver This commit adds a V4L2 subdevice driver for the OmniVision OS05E10 CMOS image sensor supporting 2592x1944 output with exposure, gain, and vertical blanking controls. > diff --git a/drivers/media/i2c/os05e10.c b/drivers/media/i2c/os05e10.c > new file mode 100644 > index 0000000000000..daf5297a6fad5 > --- /dev/null > +++ b/drivers/media/i2c/os05e10.c [ ... ] > +static const u32 os05e10_mbus_codes[] =3D { > + MEDIA_BUS_FMT_SRGGB10_1X10, > +}; [Severity: Medium] Does the sensor output SRGGB10 or SBGGR10? The commit message says SBGGR10, while os05e10_mbus_codes[] advertises MEDIA_BUS_FMT_SRGGB10_1X10. If the hardware outputs SBGGR10, reporting SRGGB10 swaps red and blue channels in downstream debayering. [ ... ] > +static u64 os05e10_pixel_rate(const struct os05e10_mode *mode) > +{ > + /* pixel_rate =3D link_freq * 2 * nr_of_lanes / bits_per_sample */ > + return div_u64(OS05E10_LINK_FREQ_720MHZ * 2 * OS05E10_DATA_LANES, > + mode->bpp); > +} [Severity: Medium] Can OS05E10_LINK_FREQ_720MHZ * 2 * OS05E10_DATA_LANES overflow on 32-bit architectures? HZ_PER_MHZ is 1000000UL, so the product 5,760,000,000 is evaluated in 32-bit unsigned long before widening to u64 for div_u64(). That triggers a compile-time overflow warning and wraps V4L2_CID_PIXEL_RATE from 576,000,000 Hz to 146,503,270 Hz. Using 64-bit arithmetic (such as 720ULL * HZ_PER_MHZ or link_freq_menu_items[0]) avoids the wrap. [ ... ] > + vblank_def =3D mode->vts - mode->height; > + os05e10->vblank =3D v4l2_ctrl_new_std(ctrl_hdlr, &os05e10_ctrl_ops, > + V4L2_CID_VBLANK, > + OS05E10_VTS_BASE - mode->height, > + OS05E10_VTS_BASE - mode->height + > + OS05E10_VBLANK_MAX, > + 1, vblank_def); [Severity: Medium] Should os05e10_init_controls() also register V4L2_CID_HBLANK? Raw camera sensor drivers are expected to expose V4L2_CID_HBLANK alongside V4L2_CID_VBLANK and V4L2_CID_PIXEL_RATE so userspace stacks such as libcamera can compute line length, exposure duration, and frame interval. OS05E10_REG_VTS and OS05E10_REG_HTS are defined earlier in the file but never used. [ ... ] > +static int os05e10_disable_streams(struct v4l2_subdev *sd, > + struct v4l2_subdev_state *state, u32 pad, > + u64 streams_mask) > +{ > + struct os05e10 *os05e10 =3D to_os05e10(sd); > + int ret; > + > + ret =3D cci_write(os05e10->cci, OS05E10_REG_STREAM_CTRL, > + OS05E10_STREAM_CTRL_OFF, NULL); > + if (ret) > + dev_err(os05e10->dev, "Failed to stop stream\n"); > + > + pm_runtime_put(os05e10->dev); > + > + return ret; > +} [Severity: Medium] Does returning a non-zero ret after pm_runtime_put() leave V4L2 stream state out of sync with runtime PM? When cci_write() fails, the sensor is still powered down, but v4l2_subdev_disable_streams() skips v4l2_subdev_set_streams_enabled(..., false) on error. Subsequent enable calls then fail with -EALREADY, and a retry of disable runs pm_runtime_put() a second time and underflows usage_count. Returning 0 after logging the error and calling pm_runtime_put() keeps both in sync. [ ... ] > + fmt->format.code =3D os05e10_mbus_codes[0]; > + fmt->format.width =3D mode->width; > + fmt->format.height =3D mode->height; > + fmt->format.field =3D V4L2_FIELD_NONE; > + fmt->format.colorspace =3D V4L2_COLORSPACE_RAW; > + fmt->format.quantization =3D V4L2_QUANTIZATION_FULL_RANGE; > + fmt->format.xfer_func =3D V4L2_XFER_FUNC_NONE; > + > + *format =3D fmt->format; [Severity: Low] Should os05e10_set_pad_format() also initialize fmt->format.ycbcr_enc and clear fmt->format.flags? VIDIOC_SUBDEV_S_FMT only zeroes the reserved fields, so arbitrary values passed by userspace in ycbcr_enc or flags are stored in the subdev state and returned on VIDIOC_SUBDEV_G_FMT. [ ... ] > +error_out: > + v4l2_fwnode_endpoint_free(&bus_cfg); > + > + return ret; > +}; [Severity: Low] There is a stray semicolon after the closing brace of os05e10_parse_endpoint(). A few other small cleanups: struct os05e10 has an unused vblank pointer, linux/bitops.h and linux/cleanup.h are included without being used, and the VIDEO_OS05E10 entry in drivers/media/i2c/Kconfig uses spaces instead of tabs for indentation. [ ... ] > + pm_runtime_set_active(os05e10->dev); > + pm_runtime_enable(os05e10->dev); > + > + ret =3D v4l2_async_register_subdev_sensor(&os05e10->sd); > + if (ret) { > + dev_err_probe(os05e10->dev, ret, > + "failed to register os05e10 sub-device\n"); > + goto error_subdev_cleanup; > + } > + > + pm_runtime_idle(os05e10->dev); > + > + return 0; > + > +error_subdev_cleanup: > + v4l2_subdev_cleanup(&os05e10->sd); > + pm_runtime_disable(os05e10->dev); > + pm_runtime_set_suspended(os05e10->dev); > + > +error_media_entity: > + media_entity_cleanup(&os05e10->sd.entity); > + > +error_handler_free: > + v4l2_ctrl_handler_free(os05e10->sd.ctrl_handler); > + > +error_power_off: > + os05e10_power_off(os05e10->dev); [Severity: Medium] Can error_power_off call os05e10_power_off() a second time if the device runtime-suspends while v4l2_async_register_subdev_sensor() is running? Runtime PM is enabled with usage_count at 0 before registration. If an async notifier exposes /dev/v4l-subdevX and then fails a later step such as media_device_register(), a concurrent VIDIOC_S_CTRL can suspend the sensor before the probe error path runs: CPU0 (os05e10_probe) CPU1 (VIDIOC_S_CTRL / kworker) pm_runtime_set_active() pm_runtime_enable() v4l2_async_register_subdev_sensor() ... v4l2_device_register_subdev_nodes() os05e10_set_ctrl() pm_runtime_get_if_active() (0 -> 1) pm_runtime_put() (1 -> 0) pm_runtime_work -> os05e10_power_off() media_device_register() fails error_subdev_cleanup: pm_runtime_disable() pm_runtime_set_suspended() error_power_off: os05e10_power_off() <-- second clk/regulator disable That causes unbalanced clk_disable_unprepare() and regulator_bulk_disable() calls and WARN splats. Calling pm_runtime_get_noresume() before pm_runtime_enable() (paired with pm_runtime_put() on success and pm_runtime_put_noidle() on error) prevents runtime suspend during probe. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204132832.1309= 79-1-bhavin.sharma@siliconsignals.io?part=3D2