From: sashiko-bot@kernel.org
To: "Wenmeng Liu" <wenmeng.liu@oss.qualcomm.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 2/3] media: i2c: og0ve1b: Introduce per-sensor data structure
Date: Thu, 02 Jul 2026 11:04:31 +0000 [thread overview]
Message-ID: <20260702110432.441311F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260702-og0va1b-v2-2-0071442caa2a@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Incorrect return value check of pm_runtime_get_if_active() leads to unbalanced PM usage count and potential log-spam.
--
commit 77fd9b09419f467242cfd9a487b0ac45ff5344ef
Author: Wenmeng Liu <wenmeng.liu@oss.qualcomm.com>
media: i2c: og0ve1b: Introduce per-sensor data structure
This patch moves sensor-specific parameters into a new
struct og0ve1b_sensor_data to prepare for supporting additional
OmniVision sensors. The sensor data is selected at probe time
using i2c_get_match_data().
> diff --git a/drivers/media/i2c/og0ve1b.c b/drivers/media/i2c/og0ve1b.c
> index 84a28cdcade10..acc06b10bf896 100644
> --- a/drivers/media/i2c/og0ve1b.c
> +++ b/drivers/media/i2c/og0ve1b.c
[ ... ]
> @@ -261,23 +272,39 @@ static const struct og0ve1b_mode supported_modes[] = {
[ ... ]
> static int og0ve1b_set_ctrl(struct v4l2_ctrl *ctrl)
> {
> struct og0ve1b *og0ve1b = container_of(ctrl->handler, struct og0ve1b,
> ctrl_handler);
> - const struct og0ve1b_mode *mode = &supported_modes[0];
> + const struct og0ve1b_mode *mode = &og0ve1b->sensor->modes[0];
> s64 exposure_max;
> int ret;
[Severity: High]
This isn't a bug introduced by this patch, but I noticed a pre-existing
issue in this function regarding the return value check of
pm_runtime_get_if_active().
Later in og0ve1b_set_ctrl(), the code does:
if (!pm_runtime_get_if_active(og0ve1b->dev))
return 0;
Because pm_runtime_get_if_active() can return a negative error code
(like -EINVAL when PM is disabled), the logical NOT operator will evaluate
the negative error as false. This bypasses the error condition entirely,
allowing execution to proceed to I2C hardware register writes and
unconditionally calling pm_runtime_put().
Since the initial 'get' call did not increment the usage counter on error,
the subsequent 'put' call decrements it improperly. Could this cause an
unbalanced PM usage count underflow and trigger kernel warnings?
Should this condition be updated to explicitly check if the return value
is less than or equal to zero?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260702-og0va1b-v2-0-0071442caa2a@oss.qualcomm.com?part=2
next prev parent reply other threads:[~2026-07-02 11:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 10:52 [PATCH v2 0/3] media: i2c: Add OmniVision OG0VA1B camera sensor driver Wenmeng Liu
2026-07-02 10:52 ` [PATCH v2 1/3] dt-bindings: media: i2c: og0ve1b: Add OmniVision OG0VA1B camera sensor Wenmeng Liu
2026-07-02 12:24 ` Vladimir Zapolskiy
2026-07-02 19:21 ` Conor Dooley
2026-07-02 10:52 ` [PATCH v2 2/3] media: i2c: og0ve1b: Introduce per-sensor data structure Wenmeng Liu
2026-07-02 11:04 ` sashiko-bot [this message]
2026-07-02 13:10 ` Vladimir Zapolskiy
2026-07-02 16:31 ` Bryan O'Donoghue
2026-07-02 10:52 ` [PATCH v2 3/3] media: i2c: og0ve1b: Add support for OmniVision OG0VA1B Wenmeng Liu
2026-07-02 13:16 ` Vladimir Zapolskiy
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=20260702110432.441311F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wenmeng.liu@oss.qualcomm.com \
/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